I have Cron set up to with the following command:
* * * * * SHELL=/usr/bin/sh PATH=~/lectio-skema-til-.ics-kalender-master/script.sh
where script.sh
has
#!/usr/bin/sh
cd /var/www/html/SECRET-PATH
wget "http://localhost:9002/?skole=518&elev=36015389032" -O kalender.ics
the command wget "http://localhost:9002/?skole=518&elev=36015389032" -O kalender.ics
generates a kalender.ics
file in /var/www/html/SECRET-PATH
, and running the script.sh
file works perfectly fine, however when running it with Cron, no files are generated in /var/www/html/SECRET-PATH
.
I don't know what's wrong, because no errors are generated in the mail, and doing grep CRON /var/log/syslog
doesn't have any errors either.
/usr/bin/sh
exist? Please, change also the commandwget
to full path like this:/usr/bin/wget
– FedKad Jan 26 '20 at 14:21~
with absolute path. – FedKad Jan 26 '20 at 14:25PATH=~/lectio-skema-til-.ics-kalender-master/script.sh
will break the shell's search path for executables (including yourwget
command). Why are you doing that? In fact, why are you messing withSHELL
andPATH
at all? – steeldriver Jan 26 '20 at 14:31