0

https://www.templatemonster.com/help/magento-setting-up-the-cronjob-using-cpanel.html My cron.php is in my pub folder http://www..com/pub/cron.php Do I have to edit this

I have tried to connect through ssh via putty but putty is giving me error Any help will be appreciated Thanks

1
  • You need to set it from cPanel right?
    – Aman Alam
    Jul 9 '17 at 16:17
0

Adding cron from SSH:

Find the PHP binary and php.ini path

To display the path to your PHP binary, enter

which php

A sample result follows:

/usr/bin/php

Create the cron job

To create a cron job for the Magento file system owner, enter the following command as a user with root privileges:

crontab -u <Magento file system owner user name> -e

For example,

crontab -u magento_user -e

A text editor displays. (You might need to choose a text editor first.)

* * * * * <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
* * * * * <path to php binary> <magento install dir>/update/cron.php >> <magento install dir>/var/log/update.cron.log
* * * * * <path to php binary> <magento install dir>/bin/magento setup:cron:run >> <magento install dir>/var/log/setup.cron.log

Example:

* * * * * /usr/bin/php /var/www/magento2/bin/magento cron:run | grep -v "Ran jobs by schedule" >> /var/www/magento2/var/log/magento.cron.log
* * * * * /usr/bin/php /var/www/magento2/update/cron.php >> /var/www/magento2/var/log/update.cron.log
* * * * * /usr/bin/php /var/www/magento2/bin/magento setup:cron:run >> /var/www/magento2/var/log/setup.cron.log

If you don't need logs :

* * * * * /usr/bin/php /var/www/magento2/bin/magento cron:run >/dev/null 2>&1
* * * * * /usr/bin/php /var/www/magento2/update/cron.php >/dev/null 2>&1
* * * * * /usr/bin/php /var/www/magento2/bin/magento setup:cron:run >/dev/null 2>&1

For cPanel check below mentioned screenshot.

https://www.amanweb.in/stackexchange/cpanel-cron.jpg

You can also check document provided by magento for setting magento 2 cron.

http://devdocs.magento.com/guides/v2.0/config-guide/cli/config-cli-subcommands-cron.html

6
  • I saw your screenshot Jul 9 '17 at 16:36
  • what command can i put ? Jul 9 '17 at 16:39
  • I haven't got access to my ssh somehow i tried putty cygwin Jul 9 '17 at 16:39
  • I WANT TO KNOW IF I HAVE TO EDIT THIS FILE HOW CAN I EDIT THIS WHERE TO PUT COMMAND PATH IN THIS FILE .com/pub/cron.php Do I have to edit this I AM USING MAGENTO 2.1.7 Jul 9 '17 at 16:47
  • you have ssh access only set cron job Jul 9 '17 at 17:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.