linux crontab - ghdrako/doc_snipets GitHub Wiki

Syntax

MIN HOUR DOM MON DOW CMD

Check Cron Daemon Status

sudo systemctl status cron
sudo systemctl status crond

Simulate cron’s environment by clearing your environment variables

env -i /bin/bash --noprofile --norc -c "/path/to/your_script.sh"

Redirect Output and Errors

*/10 * * * * /path/to/your_script.sh >> /path/to/log_$(date +'\%Y-\%m-\%d').log 2>&1  # nie dziala 
*/10 * * * * /path/to/your_script.sh >> /path/to/log_$(date -I).log 2>&1 # dziala

Check the Cron Logs

/var/log/cron  # redhat
tail -f /var/log/cron