I\'m a newbie to shell scripting. I have written a shell script to do incremental backup of MySQL database.The script is in executable format and runs successfully when exec
My Issue was that I set the cron job in /etc/cron.d (Centos 7). It seems that when doing so I need to specify the user who executes the script, unlike when a cronjob is entered at a user level.
All I had to do was
*/1 * * * * root perl /path/to/my/script.sh
*/5 * * * * root php /path/to/my/script.php
Where "root" states that I am running the script as root. Also need to make sure the following are defined at the top of the file. Your paths might be different. If you are not sure try the command "which perl", "which php".
SHELL=/bin/bash
PATH=/sbin:/bin:/usr/sbin:/usr/bin