What does systemctl status cron -l returns?
Hello vpeter, "systemctl status cron -l" was returning:
● cron.service - Cron daemon
Loaded: loaded (/usr/lib/systemd/system/cron.service; disabled; vendor preset: disabled)
Active: active (running) since Fri 2017-05-19 10:01:28 EDT; 1 months 3 days ago
Process: 290 ExecStartPre=/bin/mkdir -p /storage/.cache/cron/crontabs (code=exited, status=0/SUCCESS)
Main PID: 297 (crond)
CGroup: /system.slice/cron.service
└─297 /sbin/crond -f -S
Jun 22 10:16:00 IPTV crond[297]: USER root pid 1362 cmd /storage/epg.sh
Jun 22 10:16:00 IPTV crond[297]: /bin/sh: /storage/epg.sh: not found
Jun 22 10:17:00 IPTV crond[297]: USER root pid 1364 cmd /storage/epg.sh
Jun 22 10:17:00 IPTV crond[297]: /bin/sh: /storage/epg.sh: not found
Jun 22 10:18:00 IPTV crond[297]: USER root pid 1367 cmd /storage/epg.sh
Jun 22 10:18:00 IPTV crond[297]: /bin/sh: /storage/epg.sh: not found
Jun 22 10:19:00 IPTV crond[297]: USER root pid 1372 cmd /storage/epg.sh
Jun 22 10:19:00 IPTV crond[297]: /bin/sh: /storage/epg.sh: not found
Jun 22 10:20:00 IPTV crond[297]: USER root pid 1375 cmd /storage/epg.sh
Jun 22 10:20:00 IPTV crond[297]: /bin/sh: /storage/epg.sh: not found
Display More
I tried adding "bash" to my crontab file as Jocke.Sve recommended. After that edit "systemctl status cron -l" is returning:
● cron.service - Cron daemon
Loaded: loaded (/usr/lib/systemd/system/cron.service; disabled; vendor preset: disabled)
Active: active (running) since Fri 2017-05-19 10:01:28 EDT; 1 months 3 days ago
Process: 290 ExecStartPre=/bin/mkdir -p /storage/.cache/cron/crontabs (code=exited, status=0/SUCCESS)
Main PID: 297 (crond)
CGroup: /system.slice/cron.service
└─297 /sbin/crond -f -S
Jun 22 10:25:00 IPTV crond[297]: wget: server returned error: HTTP/1.1 400 Bad Request
Jun 22 10:26:00 IPTV crond[297]: USER root pid 1415 cmd bash /storage/epg.sh
Jun 22 10:26:00 IPTV crond[297]: Connecting to <url>:<port> (<url>:<port>)
Jun 22 10:26:00 IPTV crond[297]: wget: server returned error: HTTP/1.1 400 Bad Request
Jun 22 10:27:00 IPTV crond[297]: USER root pid 1420 cmd bash /storage/epg.sh
Jun 22 10:27:00 IPTV crond[297]: Connecting to <url>:<port> (<url>:<port>)
Jun 22 10:27:00 IPTV crond[297]: wget: server returned error: HTTP/1.1 400 Bad Request
Jun 22 10:28:00 IPTV crond[297]: USER root pid 1431 cmd bash /storage/epg.sh
Jun 22 10:28:00 IPTV crond[297]: Connecting to <url>:<port> (<url>:<port>)
Jun 22 10:28:00 IPTV crond[297]: wget: server returned error: HTTP/1.1 400 Bad Request
Display More
Thanks for the useful command vpeter and for the suggestion Jocke.Sve! That seems to have gotten my cron job running.
Now I just have to figure out why my wget is throwing a bad request error, despite working perfectly the other day.
To anyone searching for a solution to crontab not running a shell script, try Jocke.Sve's advice:
Change * * * * * /path/script.sh to * * * * * bash /path/script.sh
If anyone stumbles upon this thread regarding "wget: server returned error: HTTP/1.1 400 Bad Request" make sure you don't have an empty line at the end of your script.