I am having massive trouble setting up a cron job in Magento 2Cron job script is running, but Magento order confirmation emails are not sendingCron job doesn't workCustom module cron job not runningMagento 2 Custom cron job is ignoredCron job issue with indexingHelp with Cron on Magento 2Magento 2: How to setup Cron job correctly?Should 2 of the standard cron always be running?Cron job permission issue?Cron Job In Magento
Difference between "drift" and "wander"
How can this shape perfectly cover a cube?
How do credit card companies know what type of business I'm paying for?
I sent an angry e-mail to my interviewers about a conflict at my home institution. Could this affect my application?
Using roof rails to set up hammock
Was the Lonely Mountain, where Smaug lived, a volcano?
Leveling up and Getting Items!
What is the color associated with lukewarm?
My parents claim they cannot pay for my college education; what are my options?
How could I create a situation in which a PC has to make a saving throw or be forced to pet a dog?
Why can't we feel the Earth's revolution?
Do items with curse of vanishing disappear from shulker boxes?
Are there any rules for identifying what spell an opponent is casting?
Should I move out from my current apartment before the contract ends to save more money?
For Saintsbury, which English novelists constituted the "great quartet of the mid-eighteenth century"?
Reflecting Telescope Blind Spot?
Threading data on TimeSeries
Can artificial satellite positions affect tides?
How can I improve readability and length of a method with many if statements?
Why does MAGMA claim that the automorphism group of an elliptic curve is order 24 when it is order 12?
How would Japanese people react to someone refusing to say “itadakimasu” for religious reasons?
How can religions without a hell discourage evil-doing?
How did the European Union reach the figure of 3% as a maximum allowed deficit?
Is it possible for underground bunkers on different continents to be connected?
I am having massive trouble setting up a cron job in Magento 2
Cron job script is running, but Magento order confirmation emails are not sendingCron job doesn't workCustom module cron job not runningMagento 2 Custom cron job is ignoredCron job issue with indexingHelp with Cron on Magento 2Magento 2: How to setup Cron job correctly?Should 2 of the standard cron always be running?Cron job permission issue?Cron Job In Magento
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
Sorry if this has already been answered, but I have looked around and have been unable to find the help, I've followed countless tutorials etc, just can't get my head around it.
So I have a Magento 2.1.0 website running, but It needs the standard Magento cron jobs that do the The following tasks.
Catalog Price rules
Sending Newsletters
Generating Google Sitemaps
Customer Alerts/Notifications (product price change, product back to stock)
Automatic updating of currency rates
Scheduled DB logs cleanup
However, when I try via SSH I get permission error when entering this command, so am unable to progress further, despite using the system username that has the valid permissions:
*crontab -u magento_user -e*
So I have tried doing it via plesk, but I get a "No such file exists error" when using this command (using my details obviously):
* * * * * <path to php binary> <magento install dir>/bin/magento cron:run | grep -v "Ran jobs by schedule" >> <magento install dir>/var/log/magento.cron.log
Apparently Magento.cron.log doesn't exist.
I'm stuck right now, and just really need to get this sorted. I have looked through the files through ftp, and I can't find the cron.php file everywhere seems to be referring too, so i'm completely baffled right now. Does anyone know what I am doing wrong, or what I can do to find out what the issue is.
Thank you for any help in advance.
Kind regards
magento2 cron crontab
add a comment |
Sorry if this has already been answered, but I have looked around and have been unable to find the help, I've followed countless tutorials etc, just can't get my head around it.
So I have a Magento 2.1.0 website running, but It needs the standard Magento cron jobs that do the The following tasks.
Catalog Price rules
Sending Newsletters
Generating Google Sitemaps
Customer Alerts/Notifications (product price change, product back to stock)
Automatic updating of currency rates
Scheduled DB logs cleanup
However, when I try via SSH I get permission error when entering this command, so am unable to progress further, despite using the system username that has the valid permissions:
*crontab -u magento_user -e*
So I have tried doing it via plesk, but I get a "No such file exists error" when using this command (using my details obviously):
* * * * * <path to php binary> <magento install dir>/bin/magento cron:run | grep -v "Ran jobs by schedule" >> <magento install dir>/var/log/magento.cron.log
Apparently Magento.cron.log doesn't exist.
I'm stuck right now, and just really need to get this sorted. I have looked through the files through ftp, and I can't find the cron.php file everywhere seems to be referring too, so i'm completely baffled right now. Does anyone know what I am doing wrong, or what I can do to find out what the issue is.
Thank you for any help in advance.
Kind regards
magento2 cron crontab
add a comment |
Sorry if this has already been answered, but I have looked around and have been unable to find the help, I've followed countless tutorials etc, just can't get my head around it.
So I have a Magento 2.1.0 website running, but It needs the standard Magento cron jobs that do the The following tasks.
Catalog Price rules
Sending Newsletters
Generating Google Sitemaps
Customer Alerts/Notifications (product price change, product back to stock)
Automatic updating of currency rates
Scheduled DB logs cleanup
However, when I try via SSH I get permission error when entering this command, so am unable to progress further, despite using the system username that has the valid permissions:
*crontab -u magento_user -e*
So I have tried doing it via plesk, but I get a "No such file exists error" when using this command (using my details obviously):
* * * * * <path to php binary> <magento install dir>/bin/magento cron:run | grep -v "Ran jobs by schedule" >> <magento install dir>/var/log/magento.cron.log
Apparently Magento.cron.log doesn't exist.
I'm stuck right now, and just really need to get this sorted. I have looked through the files through ftp, and I can't find the cron.php file everywhere seems to be referring too, so i'm completely baffled right now. Does anyone know what I am doing wrong, or what I can do to find out what the issue is.
Thank you for any help in advance.
Kind regards
magento2 cron crontab
Sorry if this has already been answered, but I have looked around and have been unable to find the help, I've followed countless tutorials etc, just can't get my head around it.
So I have a Magento 2.1.0 website running, but It needs the standard Magento cron jobs that do the The following tasks.
Catalog Price rules
Sending Newsletters
Generating Google Sitemaps
Customer Alerts/Notifications (product price change, product back to stock)
Automatic updating of currency rates
Scheduled DB logs cleanup
However, when I try via SSH I get permission error when entering this command, so am unable to progress further, despite using the system username that has the valid permissions:
*crontab -u magento_user -e*
So I have tried doing it via plesk, but I get a "No such file exists error" when using this command (using my details obviously):
* * * * * <path to php binary> <magento install dir>/bin/magento cron:run | grep -v "Ran jobs by schedule" >> <magento install dir>/var/log/magento.cron.log
Apparently Magento.cron.log doesn't exist.
I'm stuck right now, and just really need to get this sorted. I have looked through the files through ftp, and I can't find the cron.php file everywhere seems to be referring too, so i'm completely baffled right now. Does anyone know what I am doing wrong, or what I can do to find out what the issue is.
Thank you for any help in advance.
Kind regards
magento2 cron crontab
magento2 cron crontab
asked Sep 4 '16 at 19:37
Rhys EvansRhys Evans
1
1
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
I don't know what you are doing wrong but I can tell you how I set up Magento2 cron on a recent project.
I have been putting files inside the /etc/cron.d/
folder. This may be specific to certain Linux distributions and may be specific to how a particular Linux box is set up.
But in theory any file inside the /etc/cron.d/
folder will be run by cron. The syntax is slightly different but this method avoids having to work out which users' crontab to edit.
So:
# File : /etc/cron.d/magento2
# Run Magento2 cron every 7 minutes
*/7 * * * * magento_user php /var/www/html/magento2/bin/magento cron:run
[Linux commands* to create the file arecd /etc/cron.d/
ls -l
vim magento2
]
ls -l
will show you the files here already.*you might prefer to type
nano magento2
instead ofvim magento2
,nano
being a slightly more user-friendly editor for those unaccustomed to editing text files in Linuxplease note: add a blank line at the end of this text file after the cron entry so the file ends with an empty line (this may be superstition but there is no harm in it)
To check that cron is running, on the Linux command prompt enter:
grep CRON /var/log/syslog
if that fails (Linux setups vary in where cron logs to) try
tail -n 100 /var/log/cron
[if that fails, hit the internet for advice such as this from Benjamin Cane]
You should see some log entries from various cron jobs that are running. If you do not see any recent entries then perhaps the Linux cron is not running but I think that would be unusual (and a whole different Q&A).
Eventually you should see a Magento entry in your Linux cron log due to the file you put in /etc/cron.d/
for example I see this:
CROND[3196]: (magento_user) CMD (php /var/www/html/magento2/bin/magento cron:run)
Then the main way I check Magento cron is behaving is to study the Magento database table cron_schedule
closely (using a tool such as MySQL Workbench).
If the Linux OS cron is calling Magento2 cron then you should see entries in this table with status pending
. Presently you should see status complete
or perhaps a useful error message to indicate where the Magento cron failed.
==================================
Adendum
I re-read your question.
cron.php
is from Magento 1.x so you should ignore any advice related to that- if you want to log to
<magento install path>/var/log/some-cron-file.log
then you do probably need to create that file first bycd /full-path-to-magento-install/var/log/
,ls -l
,touch some-cron-file.log
and then the harder part: give your new file the correct ownership and permissions for Linux cron to be able to write here. I don't know what they are for you but I know you can work that out. (but you don't really need to make your own log entries, the Linux system will most likely, and can be set to, log cron jobs tosyslog
or a dedicated log file)
add a comment |
Your Answer
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "479"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f134679%2fi-am-having-massive-trouble-setting-up-a-cron-job-in-magento-2%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
I don't know what you are doing wrong but I can tell you how I set up Magento2 cron on a recent project.
I have been putting files inside the /etc/cron.d/
folder. This may be specific to certain Linux distributions and may be specific to how a particular Linux box is set up.
But in theory any file inside the /etc/cron.d/
folder will be run by cron. The syntax is slightly different but this method avoids having to work out which users' crontab to edit.
So:
# File : /etc/cron.d/magento2
# Run Magento2 cron every 7 minutes
*/7 * * * * magento_user php /var/www/html/magento2/bin/magento cron:run
[Linux commands* to create the file arecd /etc/cron.d/
ls -l
vim magento2
]
ls -l
will show you the files here already.*you might prefer to type
nano magento2
instead ofvim magento2
,nano
being a slightly more user-friendly editor for those unaccustomed to editing text files in Linuxplease note: add a blank line at the end of this text file after the cron entry so the file ends with an empty line (this may be superstition but there is no harm in it)
To check that cron is running, on the Linux command prompt enter:
grep CRON /var/log/syslog
if that fails (Linux setups vary in where cron logs to) try
tail -n 100 /var/log/cron
[if that fails, hit the internet for advice such as this from Benjamin Cane]
You should see some log entries from various cron jobs that are running. If you do not see any recent entries then perhaps the Linux cron is not running but I think that would be unusual (and a whole different Q&A).
Eventually you should see a Magento entry in your Linux cron log due to the file you put in /etc/cron.d/
for example I see this:
CROND[3196]: (magento_user) CMD (php /var/www/html/magento2/bin/magento cron:run)
Then the main way I check Magento cron is behaving is to study the Magento database table cron_schedule
closely (using a tool such as MySQL Workbench).
If the Linux OS cron is calling Magento2 cron then you should see entries in this table with status pending
. Presently you should see status complete
or perhaps a useful error message to indicate where the Magento cron failed.
==================================
Adendum
I re-read your question.
cron.php
is from Magento 1.x so you should ignore any advice related to that- if you want to log to
<magento install path>/var/log/some-cron-file.log
then you do probably need to create that file first bycd /full-path-to-magento-install/var/log/
,ls -l
,touch some-cron-file.log
and then the harder part: give your new file the correct ownership and permissions for Linux cron to be able to write here. I don't know what they are for you but I know you can work that out. (but you don't really need to make your own log entries, the Linux system will most likely, and can be set to, log cron jobs tosyslog
or a dedicated log file)
add a comment |
I don't know what you are doing wrong but I can tell you how I set up Magento2 cron on a recent project.
I have been putting files inside the /etc/cron.d/
folder. This may be specific to certain Linux distributions and may be specific to how a particular Linux box is set up.
But in theory any file inside the /etc/cron.d/
folder will be run by cron. The syntax is slightly different but this method avoids having to work out which users' crontab to edit.
So:
# File : /etc/cron.d/magento2
# Run Magento2 cron every 7 minutes
*/7 * * * * magento_user php /var/www/html/magento2/bin/magento cron:run
[Linux commands* to create the file arecd /etc/cron.d/
ls -l
vim magento2
]
ls -l
will show you the files here already.*you might prefer to type
nano magento2
instead ofvim magento2
,nano
being a slightly more user-friendly editor for those unaccustomed to editing text files in Linuxplease note: add a blank line at the end of this text file after the cron entry so the file ends with an empty line (this may be superstition but there is no harm in it)
To check that cron is running, on the Linux command prompt enter:
grep CRON /var/log/syslog
if that fails (Linux setups vary in where cron logs to) try
tail -n 100 /var/log/cron
[if that fails, hit the internet for advice such as this from Benjamin Cane]
You should see some log entries from various cron jobs that are running. If you do not see any recent entries then perhaps the Linux cron is not running but I think that would be unusual (and a whole different Q&A).
Eventually you should see a Magento entry in your Linux cron log due to the file you put in /etc/cron.d/
for example I see this:
CROND[3196]: (magento_user) CMD (php /var/www/html/magento2/bin/magento cron:run)
Then the main way I check Magento cron is behaving is to study the Magento database table cron_schedule
closely (using a tool such as MySQL Workbench).
If the Linux OS cron is calling Magento2 cron then you should see entries in this table with status pending
. Presently you should see status complete
or perhaps a useful error message to indicate where the Magento cron failed.
==================================
Adendum
I re-read your question.
cron.php
is from Magento 1.x so you should ignore any advice related to that- if you want to log to
<magento install path>/var/log/some-cron-file.log
then you do probably need to create that file first bycd /full-path-to-magento-install/var/log/
,ls -l
,touch some-cron-file.log
and then the harder part: give your new file the correct ownership and permissions for Linux cron to be able to write here. I don't know what they are for you but I know you can work that out. (but you don't really need to make your own log entries, the Linux system will most likely, and can be set to, log cron jobs tosyslog
or a dedicated log file)
add a comment |
I don't know what you are doing wrong but I can tell you how I set up Magento2 cron on a recent project.
I have been putting files inside the /etc/cron.d/
folder. This may be specific to certain Linux distributions and may be specific to how a particular Linux box is set up.
But in theory any file inside the /etc/cron.d/
folder will be run by cron. The syntax is slightly different but this method avoids having to work out which users' crontab to edit.
So:
# File : /etc/cron.d/magento2
# Run Magento2 cron every 7 minutes
*/7 * * * * magento_user php /var/www/html/magento2/bin/magento cron:run
[Linux commands* to create the file arecd /etc/cron.d/
ls -l
vim magento2
]
ls -l
will show you the files here already.*you might prefer to type
nano magento2
instead ofvim magento2
,nano
being a slightly more user-friendly editor for those unaccustomed to editing text files in Linuxplease note: add a blank line at the end of this text file after the cron entry so the file ends with an empty line (this may be superstition but there is no harm in it)
To check that cron is running, on the Linux command prompt enter:
grep CRON /var/log/syslog
if that fails (Linux setups vary in where cron logs to) try
tail -n 100 /var/log/cron
[if that fails, hit the internet for advice such as this from Benjamin Cane]
You should see some log entries from various cron jobs that are running. If you do not see any recent entries then perhaps the Linux cron is not running but I think that would be unusual (and a whole different Q&A).
Eventually you should see a Magento entry in your Linux cron log due to the file you put in /etc/cron.d/
for example I see this:
CROND[3196]: (magento_user) CMD (php /var/www/html/magento2/bin/magento cron:run)
Then the main way I check Magento cron is behaving is to study the Magento database table cron_schedule
closely (using a tool such as MySQL Workbench).
If the Linux OS cron is calling Magento2 cron then you should see entries in this table with status pending
. Presently you should see status complete
or perhaps a useful error message to indicate where the Magento cron failed.
==================================
Adendum
I re-read your question.
cron.php
is from Magento 1.x so you should ignore any advice related to that- if you want to log to
<magento install path>/var/log/some-cron-file.log
then you do probably need to create that file first bycd /full-path-to-magento-install/var/log/
,ls -l
,touch some-cron-file.log
and then the harder part: give your new file the correct ownership and permissions for Linux cron to be able to write here. I don't know what they are for you but I know you can work that out. (but you don't really need to make your own log entries, the Linux system will most likely, and can be set to, log cron jobs tosyslog
or a dedicated log file)
I don't know what you are doing wrong but I can tell you how I set up Magento2 cron on a recent project.
I have been putting files inside the /etc/cron.d/
folder. This may be specific to certain Linux distributions and may be specific to how a particular Linux box is set up.
But in theory any file inside the /etc/cron.d/
folder will be run by cron. The syntax is slightly different but this method avoids having to work out which users' crontab to edit.
So:
# File : /etc/cron.d/magento2
# Run Magento2 cron every 7 minutes
*/7 * * * * magento_user php /var/www/html/magento2/bin/magento cron:run
[Linux commands* to create the file arecd /etc/cron.d/
ls -l
vim magento2
]
ls -l
will show you the files here already.*you might prefer to type
nano magento2
instead ofvim magento2
,nano
being a slightly more user-friendly editor for those unaccustomed to editing text files in Linuxplease note: add a blank line at the end of this text file after the cron entry so the file ends with an empty line (this may be superstition but there is no harm in it)
To check that cron is running, on the Linux command prompt enter:
grep CRON /var/log/syslog
if that fails (Linux setups vary in where cron logs to) try
tail -n 100 /var/log/cron
[if that fails, hit the internet for advice such as this from Benjamin Cane]
You should see some log entries from various cron jobs that are running. If you do not see any recent entries then perhaps the Linux cron is not running but I think that would be unusual (and a whole different Q&A).
Eventually you should see a Magento entry in your Linux cron log due to the file you put in /etc/cron.d/
for example I see this:
CROND[3196]: (magento_user) CMD (php /var/www/html/magento2/bin/magento cron:run)
Then the main way I check Magento cron is behaving is to study the Magento database table cron_schedule
closely (using a tool such as MySQL Workbench).
If the Linux OS cron is calling Magento2 cron then you should see entries in this table with status pending
. Presently you should see status complete
or perhaps a useful error message to indicate where the Magento cron failed.
==================================
Adendum
I re-read your question.
cron.php
is from Magento 1.x so you should ignore any advice related to that- if you want to log to
<magento install path>/var/log/some-cron-file.log
then you do probably need to create that file first bycd /full-path-to-magento-install/var/log/
,ls -l
,touch some-cron-file.log
and then the harder part: give your new file the correct ownership and permissions for Linux cron to be able to write here. I don't know what they are for you but I know you can work that out. (but you don't really need to make your own log entries, the Linux system will most likely, and can be set to, log cron jobs tosyslog
or a dedicated log file)
edited Sep 5 '16 at 9:52
answered Sep 5 '16 at 9:34
MalachyMalachy
54648
54648
add a comment |
add a comment |
Thanks for contributing an answer to Magento Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f134679%2fi-am-having-massive-trouble-setting-up-a-cron-job-in-magento-2%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown