Search code examples
linuxcronsuse

Cron job not running automatically for a non-root user


I am running SUSE Linux as a non-root user (getting root access also will not be a possibility). I would like to have a .sh script I created be run daily. My crontab looks like:

0 0 * * * * /path/to/file.sh

I also have a line return after this as per many troubleshooting suggestions. My script deletes files older than 14 days. I also added a means to log output to check whether the script runs.

However, the job does not run automatically. I also am not able to check /var/log/messages for any notifications on whether cron can run or not.

What am I doing wrong? How can I check if cron itself is running/can run for my user? Do I have to supply cron with any paths or environment variables?


Solution

  • The correct approach to run your cron every midnight is:

    00 00 * * * /bin/bash path/to/your/script.sh >> /path/to/log/file.log