Basic Question About CRON jobs

Your software
My Mautic version is: 3.3.4
My PHP version is: 7.3
My Database type and version is:

Your problem
My problem is:

Hi Guys… newbie in this arena.
I used A2 hosting and installed Mautic with Softaculous.
I created an addon domain for my Mautic. Set up the cron jobs:
/ mautic:segments:update

received email with the title:
Cron <***> /home// mautic:email:fetch

email content:
/bin/bash: /home/*******/ Permission denied

may I know what is it that i need to edit or rectify to get the cron jobs working?

Who sent you that email in question? Is that A2 support?

the mails are from From: (Cron Daemon)](mailto:******

the receiving mail account is the default mail account created by A2 for my hosting package.
The mail was not received by any of the sub domain email account or admin email account.

similar emails were received for all the cron jobs created.

Run cronjob as web server user (typically www-data) user, I thin that is the simplest solution here

Probably you turned on cron job execution notifications.
What is your exact command?
“bin/bash” doesn’t look good. It should start with “php”.

/home/×××××××/ mautic:segments:update

This is one of the sample commands as suggested by A2…

The command should have something like php in front.

I added “php” to the front of the command and received emails with content as follow:

Mautic 3.3.4 - app/prod (kernel: app, env: prod, debug: false)

command [options] [arguments]

-h, --help Display this help message
-q, --quiet Do not output any message
-V, --version Display this application version
–ansi Force ANSI output
–no-ansi Disable ANSI output
-n, --no-interaction Do not ask any interactive question
-e, --env=ENV The Environment name. [default: “prod”]
–no-debug Switches off debug mode.
-v|vv|vvv, --verbose Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug

Available commands:
about Displays information about the current project
help Displays help for a command
list Lists commands
assets:install Installs bundles web assets under a public directory
bazinga:oauth-server:clean Clean expired tokens
cache:clear Clears the cache
cache:pool:clear Clears cache pools
cache:pool:prune Prunes cache pools
cache:warmup Warms up an empty cache
config:dump-reference Dumps the default configuration for an extension
debug:autowiring Lists classes/interfaces you can use for autowiring
debug:config Dumps the current configuration for an extension
debug:container Displays current services for an application
debug:event-dispatcher Displays configured listeners for an application
debug:form Displays form type information
debug:router Displays current routes for an application
debug:swiftmailer Displays current mailers for an application
debug:translation Displays translation messages information
debug:twig Shows a list of twig functions, filters, globals and tests
doctrine:cache:clear-collection-region Clear a second-level cache collection region
doctrine:cache:clear-entity-region Clear a second-level cache entity region
doctrine:cache:clear-metadata Clears all metadata cache for an entity manager
doctrine:cache:clear-query Clears all query cache for an entity manager
doctrine:cache:clear-query-region Clear a second-level cache query region
doctrine:cache:clear-result Clears result cache for an entity manager
doctrine:cache:contains Check if a cache entry exists
doctrine:cache:delete Delete a cache entry
doctrine:cache:flush [doctrine:cache:clear] Flush a given cache
doctrine:cache:stats Get stats on a given cache provider
doctrine:database:create Creates the configured database
doctrine:database:drop Drops the configured database
doctrine:database:import Import SQL file(s) directly to Database.
doctrine:ensure-production-settings Verify that Doctrine is properly configured for a production environment
doctrine:fixtures:load Load data fixtures to your database
doctrine:generate:entities [generate:doctrine:entities] Generates entity classes and method stubs from your mapping information
doctrine:mapping:convert [orm:convert:mapping] Convert mapping information between supported formats
doctrine:mapping:import Imports mapping information from an existing database
doctrine:migrations:diff [diff] Generate a migration by comparing your current database to your mapping information.
doctrine:migrations:dump-schema [dump-schema] Dump the schema for your database to a migration.
doctrine:migrations:execute [execute] Execute a single migration version up or down manually.
doctrine:migrations:generate [generate] Generate a blank migration class.
doctrine:migrations:latest [latest] Outputs the latest version number
doctrine:migrations:migrate [migrate] Execute a migration to a specified version or the latest available version.
doctrine:migrations:rollup [rollup] Rollup migrations by deleting all tracked versions and insert the one version that exists.
doctrine:migrations:status [status] View the status of a set of migrations.
doctrine:migrations:up-to-date [up-to-date] Tells you if your schema is up-to-date.
doctrine:migrations:version [version] Manually add and delete migration versions from the version table.
doctrine:query:dql Executes arbitrary DQL directly from the command line
doctrine:query:sql Executes arbitrary SQL directly from the command line.
doctrine:schema:create Executes (or dumps) the SQL needed to generate the database schema
doctrine:schema:drop Executes (or dumps) the SQL needed to drop the current database schema
doctrine:schema:update Executes (or dumps) the SQL needed to update the database schema to match the current mapping metadata
doctrine:schema:validate Validate the mapping files
fos:oauth-server:clean Clean expired tokens
fos:oauth-server:create-client Creates a new client
lint:twig Lints a template and outputs encountered errors
lint:xliff Lints a XLIFF file and outputs encountered errors
lint:yaml Lints a file and outputs encountered errors
mautic:assets:generate Combines and minifies asset files from each bundle into single production files
mautic:broadcasts:send Process contacts pending to receive a channel broadcast.
mautic:cache:clear Clears Mautic’s cache
mautic:campaigns:execute Execute specific scheduled events.
mautic:campaigns:rebuild [mautic:campaigns:update] Rebuild campaigns based on contact segments.
mautic:campaigns:trigger Trigger timed events for published campaigns.
mautic:campaigns:validate Validate if a contact has been inactive for a decision and execute events if so.
mautic:citrix:sync Synchronizes registrant information from Citrix products
mautic:contacts:deduplicate Merge contacts based on same unique identifiers
mautic:custom-field:create-column Create custom field column in the background
mautic:donotsell:download Fetch remote do not sell list from MaxMind
mautic:email:fetch [mautic:emails:fetch] Fetch and process monitored email.
mautic:emails:send Processes SwiftMail’s mail queue
mautic:import Imports data to Mautic
mautic:install Installs Mautic
mautic:install:data Installs Mautic with sample data
mautic:integration:fetchleads [mautic:integration:synccontacts] Fetch leads from integration.
mautic:integration:pipedrive:fetch Pulls the data from Pipedrive and sends it to Mautic
mautic:integration:pipedrive:push Pushes the data from Mautic to Pipedrive
mautic:integration:pushleadactivity [mautic:integration:pushactivity] Push lead activity to integration.
mautic:integrations:sync Fetch objects from integration.
mautic:iplookup:download Fetch remote datastores for IP lookup services that leverage local lookups
mautic:maintenance:cleanup Updates the Mautic application
mautic:max-mind:purge Purge data connected to MaxMind Do Not Sell list.
mautic:messages:send [mautic:campaigns:messagequeue|mautic:campaigns:messages] Process sending of messages queue.
mautic:plugins:reload [mautic:plugins:install|mautic:plugins:update] Installs, updates, enable and/or disable plugins.
mautic:queue:process Process queues
mautic:reports:scheduler Processes scheduler for report’s export
mautic:segments:check-builders Compare output of query builders for given segments
mautic:segments:update [mautic:segments:rebuild] Update contacts in smart segments based on new contact data.
mautic:social:monitoring Looks at the records of monitors and iterates through them.
mautic:theme:json-config Converts theme config to JSON from PHP
mautic:transifex:pull Fetches translations for Mautic from Transifex
mautic:transifex:push Pushes Mautic translation resources to Transifex
mautic:translation:debug Displays translation messages informations
mautic:unusedip:delete Deletes IP addresses that are not used in any other database table
mautic:update:apply Updates the Mautic application
mautic:update:find Fetches updates for Mautic
mautic:webhooks:process Process queued webhook payloads
oneup:uploader:clear-chunks Clear chunks according to the max-age you defined in your configuration.
oneup:uploader:clear-orphans Clear orphaned uploads according to the max-age you defined in your configuration.
router:match Helps debug routes by simulating a path info match
security:encode-password Encodes a password.
social:monitor:twitter:hashtags Looks at our monitoring records and finds hashtags
social:monitor:twitter:mentions Searches for mentioned tweets
swiftmailer:email:send Send simple email message
swiftmailer:spool:send Sends emails from the spool
translation:update Updates the translation file
X-Powered-By: PHP/7.3.30
Content-type: text/html; charset=UTF-8


Here are instructions on how to setup cronjobs: Cron jobs | Mautic

Also since you are dealing with cronjobs here I would suggest providing absolute path to php command (in front of each command). You can find out what the absolute path is, by typing whereis php

You are on the right track.

You probably ran this:


You need to add the ending too.

php /home/×××××××/ mautic:segments:update

It should be fine.

hi [mzagmajster]

Am still learning big time…
after using “whereis php”, I got the path as “/usr/local/bin/php”. Am I right to say that I should just use this exact path? Or do I need to replace any part of the path?

Hi joeyk,

Thanks for your patient with me. Actually, I added ending for all the cron jobs.
Will try to run the cron jobs again and see how things turn out. Will seek more assistance here when the need arise.

Thanks :slight_smile:

Yes use the path you got to call the script, so something like:

/usr/local/bin/php /home/×××××××/ mautic:segments:update

thanks a lot… will try that out also…:smiley: hope it can solve all the issues…:smiley:

Once you ‘solve it’ it will be time to optimize: