Note. These comments apply to / etc / crontab.
Before doing anything else, which cron are you accessing crontab -e or
su -vim <your-favorite-editor> /etc/crontab
If you use crontab -e, then there will be no user field in this form of crontab. Perhaps that is why you are not working.
In your example, your user field is *. I would make it root or a user who has the appropriate permissions.
Before starting this program, I will make a fictitious record of crontab, which simply makes echo "Hello" and starts every minute. Get this to work on which ever crontab you are editing (crontab -e or vim / etc / crontab). Then, using this as a template, run your script.
Next, see if cron works:
ps -ef | grep cron
If it is not running, run it and enter it
/etc/init.d/cron start (Ubuntu and Red Hat).
You already have a good answer involving adding root as a user due to a permission issue. I am going to offer more things to help you debug. Over the years, I have encountered many cron issues.
1) Set the email address to a known address if you do not constantly monitor the root email address
SHELL=/bin/bash PATH=/sbin:/bin:/usr/sbin:/usr/local/bin:/usr/bin MAILTO=fred@somewhere.com HOME=/
2) Until everything is done correctly, remove >/dev/null 2>&1 from your cron entry, so that you will see the outputs in your letter created after the script was run.
3) Bump */15 accurate to an interval exceeding your script to run - likr */5 , so the script runs more often.
4) I donβt know the exact reason, but the scripts that end with cron should create their own environments, despite the fact that they are run as a user in cron. This may include steps such as cd /home/script-owner and starting source .bashrc , as well as calling other script (s) that set the environment variables.