Problem with cron jobs [Solved]

Hi Everyone,

i am having some issue with cron jobs. i have had cron jobs set up and working fine since matrix, that pull an M3u file in the night. it has also been working fine in each release of Nexus, however, i upgraded my N2+ to boot / run CE from SSD (i have seen a MASSIVE improvement in mariadb post upgrade!)

i started from scratch with the SSD, installing everying fresh and configuring cron jobs. they all appear as exeprected when i run crontab -e, i have confrimed cron is enabled on CE settings, and have verified the files cron calls are in correct path and work as expected when i run them over ssh, but they do not seem to run on schedue and download the m3u (or maybe they do run but fail for some reason)

is there some log i can check to see if the jobs even tried to run or if they failed, and if tried and failed, with what error?

Thanks

journalctl -l

journalctl -l | grep -i cron
1 Like

Thanks, i ran those. the secomd didnt return anything. The first did but only went back couple of hours so guees earlier when i would have expected cron entries has FIFO. will adust the schedule and run again just after expected run time. Thanks again!

Check if cron daemon is actually running.

ps -ef | grep crond

i think it is - see below
CentralKodi:~ # ps -ef | grep crond
3305 root 0:00 /sbin/crond -f -S
25463 root 0:00 grep crond

Then just add one new entry job to expire in a few minutes. And you should see in journal if was executed.

yep, one should run in two mins from now…

Parse error!! maybe screwed my sh files updating them in notepad in Windows…thanks :smile:

so now i am really baffled. converted to Unix LF in notepad++. same parse error. loaded in nano on the N2 and saved, same parse error.

originally i created dloadm3u.sh file and inside i had the below (but with actual url)

curl https://rest_of_url -o /storage/VOD/Shark.m3u

in cron to download every night i have
0 0 * * * /storage/VOD/dloadm3u.sh

these settings just worked untill rebuild for SSD.

i can run the content of the sh file in putty and the m3u dowloads, but if it try to run the sh file i get ‘not found’. so tried diff approach.

i renmed the .sh file removing the extention then in putty ran the file with below
sh /storage/VOD/dloadm3u

this was succsess and m3u downloaded, so i configure cron accordingly with below

12 0 * * * sh /storage/VOD/dloadm3u

but when cron ran few mins ago, same parse error

Aug 16 12:00:00 CentralKodi crond[3305]: user root: parse error at 56
Aug 16 12:00:00 CentralKodi crond[3305]: user root: parse error at 25

i also have other cron jobs that run after as next steps in the flow, converting the m3u to strm files with m2strm.exe run in mono. these are exhibiting same behavioiur also. parse error in cron but working OK in putty. i have all this x4 as i have 4 providers and each woud run in sequence, then kodi library update would run after to autamate everything through the night, and this has been working good for maybe 18 months through several kodi / CE releases. if i disconnect my SSD and put the SD back in, still running nexus 20.2 all this is working as before

its been a while since i first set all this up back on matrix, and cant recall if there was some other step i did (dont think so but its possible) what am i missing?

You didn’t provide much info about this parse error. At least the offending lines from your script if you can’t show all of it.

In shell file do you have first line

#!/bin/sh

thanks, no i dont have that at the start of the file. i recall trying that when i first tried to make it all work (i have old back up files like that which i could not get to work)

the parse error i shared is all that i get back when i run

journalctl -l | grep -i cron

for now i have only been concentrating on the download m3u step, and that file / script has only one line it it that i pasted above but with a fake url.

i will try adding that sytax to the start of my file and share outcome…thanks!

i tested all x4 of the files i have for each provider and all the same, after adding to the file, see below, last one it did looks like this

#!/bin/sh
curl https://actual_url -o /storage/VODEmpire/Shark.m3u

if i run it in putty it works and i get below
/VODEmpire # sh dloadm3u
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 28.4M 0 28.4M 0 0 16.7M 0 --:–:-- 0:00:01 --:–:-- 16.7M
CentralKodi:~/VODEmpire #

but from crom with 13 35 * * * sh /storage/VODEmpire/dloadm3u

the log just says
Aug 16 13:35:00 CentralKodi crond[3305]: user root: parse error at 35
Aug 16 13:35:00 CentralKodi crond[3305]: user root: parse error at 25

This parse error comes from crontab - looks like you have error somewhere in the file. Check all lines with

crontab -l

i ran that. it just listed all the entries i had when rinning in as -e. i could not see anything obvioulsy awry, but cleared out everything back on -e and will start again wiht just on line. i guess there maybe somethign i couldnt see, but i had all entried backed up to txt file, and had used this file in the past to just paste in when setting up again or on other boxes…

i will add just one line in cron and do some more testing…thanks!

something was messed up with the entires that i could not eaily see, then when i was testing / troubleshooting i stupidly got the hours and minutes reversed on crontab

i inserted my SD that was working, copied the ‘root’ file over to .cache/cron/crontab realied the mistake i had been making with hours / minutes when doing spot tests, and adjusted timings in cromtab -e

all working again

thanks very much for you guidance and sticking with me, and giving me knowledge to troubleshoot such things in the future!

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.