Scheduled Jobs in Linux using crontab (nano)

  1. Create crontab file: crontab -e
    This command will enter VI
  2. Edit crontab file
    e..g */1 * * * * php /var/html/task.php
    Execute task.php every minute.
  3. Ctrl + C to enter VI command mode and enter :wq to exit VI

Line break for log:

Nano commands:

Select: ALT + M + A
Copy: ALT + 6
Paste: CTRL + U

Note:

  • Make sure use full path to use php. e.g. /usr/bin/php index.php
  • PHP could execute URI of CodeIgniter
    /usr/bin/php /var/www/test/index.php /home/some_action

Reference: