Jump to content


Photo

Cron problem - what am I doing wrong?


  • Please log in to reply
8 replies to this topic

#1 doglover

  • Rytec EPG Team
  • 17,011 posts

+639
Excellent

Posted 28 February 2020 - 08:07

I am trying to run a cron job at boot time:

@reboot sleep 300 ; cp -f /media/HD2400/epg.dat /etc/epgimport/epg.dat ; wget http://192.168.178.15/api/loadepg

Tried also:

@reboot sleep 300 && cp -f /media/HD2400/epg.dat /etc/epgimport/epg.dat && wget http://192.168.178.15/api/loadepg

The bash commands, when entered in a telnet window, just work as expected.

 

However I find in the log for the box:

Feb 28 07:59:21 sh1 cron.err crond[428]: user root: parse error at @reboot
Feb 28 07:59:21 sh1 cron.err crond[428]: user root: parse error at sleep
Feb 28 07:59:21 sh1 cron.err crond[428]: user root: parse error at 300
Feb 28 07:59:21 sh1 cron.err crond[428]: user root: parse error at ;
Feb 28 07:59:21 sh1 cron.err crond[428]: user root: parse error at cp

I am making a mistake in the crontab, but I cannot figure out what it is.  Any help?

 

BTW: other crontabs just work prefectly.

 

Willy


Edited by doglover, 28 February 2020 - 08:13.

~~Rytec Team~~
Maxytec Multibox SE OpenPli (used as mediaplayer)
Mutant HD2400 OpenPli
Vu+ Duo OpenPli (backup)

Synology NAS

Sat: 13E, 19.2E, 23.5E and 28.2E
*Pli/Rytec EPG POWERED*


Re: Cron problem - what am I doing wrong? #2 betacentauri

  • PLi® Core member
  • 7,185 posts

+323
Excellent

Posted 28 February 2020 - 08:14

Not whether this is the problem. Afaik we use busybox crontab and I think I heard that it don’t support @reboot. If normal crontab is in the feed, install it and try again.
Xtrend ET-9200, ET-8000, ET-10000, OpenPliPC on Ubuntu 12.04

Re: Cron problem - what am I doing wrong? #3 doglover

  • Rytec EPG Team
  • 17,011 posts

+639
Excellent

Posted 28 February 2020 - 08:33

In the feed:

Package: busybox-cron
Version: 1.24.1-r0.3
Depends: busybox

No normal cron in the feed.


~~Rytec Team~~
Maxytec Multibox SE OpenPli (used as mediaplayer)
Mutant HD2400 OpenPli
Vu+ Duo OpenPli (backup)

Synology NAS

Sat: 13E, 19.2E, 23.5E and 28.2E
*Pli/Rytec EPG POWERED*


Re: Cron problem - what am I doing wrong? #4 WanWizard

  • PLi® Core member
  • 68,590 posts

+1,738
Excellent

Posted 28 February 2020 - 13:06

This may be of some help: https://forums.openp...pt-on-box-boot/


Currently in use: VU+ Duo 4K (2xFBC S2), VU+ Solo 4K (1xFBC S2), uClan Usytm 4K Pro (S2+T2), Octagon SF8008 (S2+T2), Zgemma H9.2H (S2+T2)

Due to my bad health, I will not be very active at times and may be slow to respond. I will not read the forum or PM on a regular basis.

Many answers to your question can be found in our new and improved wiki.


Re: Cron problem - what am I doing wrong? #5 Pike_Bishop

  • Senior Member
  • 1,130 posts

+72
Good

Posted 28 February 2020 - 19:43

@betacentauri is right - no parameter @reboot with busybox-cron.

 

as another alternative you can use the commands;

cp -f /media/HD2400/epg.dat /etc/epgimport/epg.dat ; wget http://192.168.178.15/api/loadepg

in a script and make a cronjob to that script for every minutes and if the script is succesfull let the same script delete the cronjob for it.

 

for what do you need a sleep 300 ? i think a sleep 20 is also enough.

 

 

regards

Pike


Receiver: VU Ultimo 4K, Octagon SF8008 4K, Gigablue Quad 4K

Image: OpenPLI-8.3


Re: Cron problem - what am I doing wrong? #6 doglover

  • Rytec EPG Team
  • 17,011 posts

+639
Excellent

Posted 29 February 2020 - 09:47

After reading all this, and realising that busybox-cron does not support @reboot decided, I go with another method:

 

Use the enigma2_pre_start.sh file and put in there:  cp -f /media/HD2400/epg.dat /etc/epgimport/epg.dat

Chose this because, I have already put stuff in this file, and it is already backed-up.

(I mount everything with fstab, so mounts are present before enigma2 starts)

 

This will copy the epg.dat file file before enigma2 is loaded.  When enigma2 is loaded it will automatically read the epg.dat file (provided you set the correct position of epg.dat in enigma2)

 

Then I have put an cron job:

30 9 * * *  cp -f /media/HD2400/epg.dat /etc/epgimport/epg.dat && wget http://192.168.178.15/api/loadepg

Which will copy again the epg,dat file when it is renewed on the other box.  (The import is performed there at 9h10)

It loads the EPG subsequently. 

 

Now you may wonder why I am doing this.  (after all I can import the EPG also on the second receiver)

This is to help somebody out with 2 receivers, for the reception of cable TV (Telenet).  He needs the use of the Telenet CI+ modules to see anything.

So the use of OpenPli is outof the question.

On his VU+ Duo 2 he can install OpenATV 6.0 which can use the CI+.  Also EPGimport on this receiver works.

 

However on his Mutant HD2400 OpenATV 6.0 his CI+ does not work.  He has to downgrade to OpenATV 5.0 for his CI+ to work.
Unfortunately the EPGimport version is pre-xz and upgrading this piece of software is very difficult.  So no EPGimport.

 

Since he has EPG on one receiver, I was thinking, how can we provide EPG on he second receiver.  And I came up with the reuse of the epg.dat on the VU+.

 

Although, I do not need it, I was testing this process out with my 2 receivers.

 

Willy


Edited by doglover, 29 February 2020 - 09:50.

~~Rytec Team~~
Maxytec Multibox SE OpenPli (used as mediaplayer)
Mutant HD2400 OpenPli
Vu+ Duo OpenPli (backup)

Synology NAS

Sat: 13E, 19.2E, 23.5E and 28.2E
*Pli/Rytec EPG POWERED*


Re: Cron problem - what am I doing wrong? #7 s3n0

  • Senior Member
  • 641 posts

+62
Good

Posted 29 February 2020 - 14:37

Hi.

 

I would like to make one technical note ;-).

CRON commands are recommended to be run with full path specification (/usr/bin/wget). The wget command without the need to check the output should be run as quiet (no info messages) with the -q argument and also with the -O - argument to redirect the response to "nothingness":

30 9 * * *     cp -f /media/HD2400/epg.dat /etc/epgimport/epg.dat && /usr/bin/wget -q -O - "http://191.168.178.15/api/loadepg"

 



Re: Cron problem - what am I doing wrong? #8 s3n0

  • Senior Member
  • 641 posts

+62
Good

Posted 29 February 2020 - 15:23

It would be much more efficient to compare time or size of these two files. Then copy or ignore the file. However, a separate shell script would be preferable for this purpose.

 

CRON (run every 15 minutes):

*/15 * * * *     /usr/bin/bash -c /usr/script/epg-check-reload.sh

Script /usr/script/epg-check-reload.sh , comparing the sizes of the two files :

#!/bin/bash

remote_epg="/media/HD2400/epg.dat"
local_epg="/etc/epgimport/epg.dat"

if [ -f $remote_epg ] && [ "$(stat -c%s $remote_epg)" != "$(stat -c%s $local_epg)" ]; then
    cp -f $remote_file $local_file
    wget -q -O - http://127.0.0.1/web/loadepg
fi

exit 0

Of course you can write it directly into CRON as one line of code, but I don't guarantee the functionality:

*/15 * * * *     /usr/bin/bash -c "if [ -f /media/HD2400/epg.dat ] && [ "$(stat -c%s /media/HD2400/epg.dat)" != "$(stat -c%s /etc/epgimport/epg.dat)" ]; then cp -f /media/HD2400/epg.dat /etc/epgimport/epg.dat; wget -q -O - http://127.0.0.1/web/loadepg; fi;"

 



Re: Cron problem - what am I doing wrong? #9 Pike_Bishop

  • Senior Member
  • 1,130 posts

+72
Good

Posted 29 February 2020 - 21:24

and at last openatv use cronie instead of busybox-cron (but i don't know since which version of openatv) and with cronie the parameter @reboot works.

 

regards

Pike


Receiver: VU Ultimo 4K, Octagon SF8008 4K, Gigablue Quad 4K

Image: OpenPLI-8.3



0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users