SSH Crontab

accountname@ip-address [~]# sudo su – –THIS CHANGED TO THE ROOT
crontab -u root -e    ===this Create or edit a crontab for the Apache user:

5 * * * * /bin/sh /home/labslabdream/public_html/cron.sh


 

From Magento
 For Magento, this user is the web server. To determine your web server's user, enter the following command:
ps -o "user group command" -C httpd,apache2
In CentOS, the Apache user is typically apache; in Ubuntu, it's typically www-data.
To create a cron job as the user who runs Apache, the following commands in the order shown:
Create or edit a crontab for the Apache user:
crontab -u apache-user-name -e
A text editor displays. (You might need to choose a text editor first.)
 In the editor, enter the following:
* * * * * /bin/sh /[your Magento install dir]/cron.sh
For example, for CentOS,
* * * * * /bin/sh /var/www/html/magento/cron.sh
Save your changes to the crontab and exit the editor.

Check that cron is running

If cron isn’t running then your commands won’t be scheduled …

ps -ef | grep cron | grep -v grep

should get you something like

root    1224   1  0 Nov16 ?    00:00:03 cron

or

root    2018   1  0 Nov14 ?    00:00:06 crond

If not restart it

/sbin/service cron start

or

/sbin/service crond start
 
in ssh, I ran service crond status

root@ip-192-169-233-43 [~]# service crond status


vi editor

In order to begin entering text in this empty file, you must change from command mode to insert mode. To do this, type

      i

To save the edits you have made, but leave vi running and your file open:

  1. Press <Esc>.
  2. Type :w
  3. Press <Return>.

To quit vi, and discard any changes your have made since last saving:

  1. Press <Esc>.
  2. Type :q!
  3. Press <Return>.
 

Comments are closed