- A Linux utility which schedules a command/script on your server to run automatically at specified times/dates. Used for scheduling repetitive tasks.
- Check logs in /etc/rsyslog.d/50-default.conf
- /var/log/syslog or /var/log/messages or /var/log/cron
- Email errors - /var/log/mail.err
- Finding the php path: whereis php
* * * * * /usr/bin/php /path/to/script.php
# Run script.sh at 5:00AM Mon-Fri and log the output to backup.log
* 5 * * 1-5 /path/to/script.sh > /path/to/backup.log 2>&1
- "2>&1" meaning => standard error (2>) is redirected to the same file descriptor that is pointed by standard output (&1)
- Use >> instead of > to append output