Cron Tips

(i actually made this because i was dumbfounded why my cron isn’t running)

Used crontab (user, not sudo or /etc/crontab) for doing things, and realize that things aren’t running.
So i’m browsing around and found these tips

Cron Stuff

  • check permission for the file / folder, use
    ls -l [file / folder name]
    

    to check

  • if not present, use
    chmod -x [file name]
    

    to add permission to execute
    (r - read, w - write, x - execute)

  • add path to the cronjob list, use
    PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/home/[username]/[folder_file]
    

    to access path (untested)

  • to get cron log (check if run)
    grep CRON /var/log/syslog
    

    or

    systemctl status cron
    
  • add a command-specific before command-to-file
    0 * * * * /bin/bash [command]
    

    to make sure it uses bash / sh

Join My Newsletter

Sign up to receive weekly updates.

x