I am attempting to get a script to run in cron.daily. The script is supposed to just echo "hello world" to an output file in my Documents directory. It works fine when I run it from the command line, but not from within cron.daily nor cron.weekly.
I have made sure that I have avoided some basic errors : the name does not contain any forbidden characters(., etc), the laptop runs on mains power, the script has execute permission.
I put a full PATH statement within the script. (Previously on advice from forum members I created an .xsessionrc file and included a PATH statement.)
Despite all this, the scripts will not run as cron jobs. Thus using run-parts --report /etc/cron.daily I get the output ...
sudo run-parts --report /etc/cron.daily
/etc/cron.daily/HiWorld:
run-parts: failed to exec /etc/cron.daily/HiWorld: No such file or directory
run-parts: /etc/cron.daily/HiWorld exited with return code 1.
So it appears that the system scripts (0anacron,dpkg, passwd, aptitude and so on) are running successfully, but mine is not.
I have tried placing the script in ~/bin, /bin, usr/bin, all to no avail.
The simple script is ......
Code: Select all
bin/sh
set -e
PATH=/usr/local/bin:/usr/bin:/bin:~/bin
echo "hello world" > /home/drtjpike/Documents/TestHiW 2>&1
Tom.
(Note I am running Debian 10 with the Cinnamon desktop.)