Hello Guest, if you are reading this it means you have not registered yet. Please take a second, Click here to register, and in a few simple steps you will be able to enjoy our community and use our OpenViX support section.
Results 1 to 15 of 15

Thread: Cron timers

  1. #1

    Title
    Senior Member
    Join Date
    Dec 2015
    Posts
    201
    Thanks
    60
    Thanked 38 Times in 27 Posts

    Cron timers

    Hi all
    I'll try to explain this the best I can, I use a script that pulls in epg data for us/foreign channels, this script creates crontimers to download from the various sources at 8am everyday, problem I have is I use other crontimers for other task's and every time I reboot the receiver my other cron tasks are overwritten as I presume the script I use is ran when the receiver boots overwriting the root file in crontabs, is there anywhere else I can place my other cron tasks so they continue to run? Sorry if it's a bit confusing but It's the best way I can explain.
    TIA

  2. #2
    birdman's Avatar
    Title
    Moderator
    Join Date
    Sep 2014
    Location
    Hitchin, UK
    Posts
    7,776
    Thanks
    237
    Thanked 1,656 Times in 1,305 Posts
    It might help if you mentioned where you put your current scripts and what they do.
    If you have a script that is overwriting other scripts that sounds like a problem with your script.
    MiracleBox Prem Twin HD - 2@DVB-T2 + Xtrend et8000 - 5(incl. 2 different USBs)@DVB-T2[terrestrial - UK Freeview HD, Sandy Heath] - LAN/USB-stick/HDD

  3. #3

    Title
    Senior Member
    Join Date
    Aug 2015
    Posts
    234
    Thanks
    131
    Thanked 68 Times in 50 Posts
    funny this has just come up as ive just come to search here for the exact same thing.
    sorry to jump in on the thread but i think maybe i can help No1gooner help explain.

    my set up might not be the same but its very similar.
    i ran a script through telnet that downloaded IPTV bouquets and the EPG.

    firstly i have a cron timer for an ongoing issue with my xtrend et8000...the issue where lines appear down the face(nose) of people due to a driver issue..as im sure you can remember. the cron timer runs a script every 5 minutes and the "root" file is located in etc/cron/crontab.
    now after running the IPTV script ...it has added several cron timers to pull in EPG and channel changes at 8am to the same root file in the crontab folder.
    this over writes my existing timer.
    i have re added my cron */5 x x x x to the root file with the IPTV timers and it shows again in menu/timers/cron but after a reboot the root file is over written again and my timer is gone and only the IPTV timers exist.

    ive tried putting my root file in etc/cron but its still the same.
    so obviously the problem lies with the IPTV script over writing the "root" file in etc/cron/crontab

    question is...is there a way to stop it?

  4. #4

    Title
    Senior Member
    Join Date
    Dec 2015
    Posts
    201
    Thanks
    60
    Thanked 38 Times in 27 Posts
    Thanks kryton you explained it a lot better then me, this is exactly what is happening, I don't think there is a way to stop it as it is an essential part of the iptv script for pulling in the epg, whenever the box reboots the script will run and keep all files up to date one of them being the root file in crontabs for iptv epg, what I would like to know is there anywhere else I can put a separate file with my own cron timers so they don't keep getting overwritten and continue to work?
    Last edited by No1gooner; 03-05-17 at 20:48.

  5. #5
    birdman's Avatar
    Title
    Moderator
    Join Date
    Sep 2014
    Location
    Hitchin, UK
    Posts
    7,776
    Thanks
    237
    Thanked 1,656 Times in 1,305 Posts
    Quote Originally Posted by No1gooner View Post
    whenever the box reboots the script will run and keep all files up to date one of them being the root file in crontabs for iptv epg
    If it is keeping a generic file up to date it should be doing so in a way that doesn't affect any other user of the file.
    MiracleBox Prem Twin HD - 2@DVB-T2 + Xtrend et8000 - 5(incl. 2 different USBs)@DVB-T2[terrestrial - UK Freeview HD, Sandy Heath] - LAN/USB-stick/HDD

  6. #6

    Title
    Forum Supporter
    Donated Member
    Join Date
    Jul 2013
    Posts
    150
    Thanks
    14
    Thanked 24 Times in 20 Posts
    Hi. Both, does your IPTV script anywhere contain the text "> /etc/cron/crontab/root" or similar. If so, amend it to contain ">>" instead - that will append rather than overwrite. Hope that helps.

  7. The Following User Says Thank You to iwg For This Useful Post:

    kryton (04-05-17)

  8. #7

    Title
    Senior Member
    Join Date
    Aug 2015
    Posts
    234
    Thanks
    131
    Thanked 68 Times in 50 Posts
    Quote Originally Posted by iwg View Post
    Hi. Both, does your IPTV script anywhere contain the text "> /etc/cron/crontab/root" or similar. If so, amend it to contain ">>" instead - that will append rather than overwrite. Hope that helps.
    in the script.sh1 file on the root of the box there is a line wget -0 /etc/cron/crontab/root....with an http:// adress before it.
    so this must be the line thats downloading and over writing the root file in crontab.
    no >> though.
    anyway to amend this so it does not completely over write the root file?
    Last edited by kryton; 04-05-17 at 23:20.

  9. #8
    birdman's Avatar
    Title
    Moderator
    Join Date
    Sep 2014
    Location
    Hitchin, UK
    Posts
    7,776
    Thanks
    237
    Thanked 1,656 Times in 1,305 Posts
    Quote Originally Posted by kryton View Post
    in the script.sh1 file on the root of the box there is a line wget -0 /etc/cron/crontab/root....with an http:// adress before it.
    so this must be the line thats downloading and over writing the root file in crontab.
    no >> though.
    anyway to amend this so it does not completely over write the root file?
    Something like this.
    Code:
    #!/bin/sh
    #
    
    # change
    # wget command.....  -0 /etc/cron/crontab/root
    # to
    cd /tmp || exit
    wget command.....  -0 epg-cron
    
    start_line="# EPG-download start - DO NOT EDIT from here to EPG-download end"
    end_line="# EPG-download end"
    
    awk "BEGIN {out = 1;}
         /^$start_line/ {out = 0;}
         /^$end_line/   {out = 1; next;}
         out == 1       {print;}
    "  /etc/cron/crontab/root > base-cron
    
    (cat base-cron
     echo $start_line
     cat epg-cron
     echo $end_line) > full.cron
    
    crontab full.cron
    
    rm -f base-cron epg-cron full.cron
    You need to make sure that you don't keep adding it every time it turns, so you add it between markers and every time it runs it deletes everything between those markers (with awk, as ed isn't installed by default) and adds the new (possibly unchanged) version again.
    You then need to resubmit the new file so that cron knows it has changed.
    Last edited by birdman; 05-05-17 at 09:47.
    MiracleBox Prem Twin HD - 2@DVB-T2 + Xtrend et8000 - 5(incl. 2 different USBs)@DVB-T2[terrestrial - UK Freeview HD, Sandy Heath] - LAN/USB-stick/HDD

  10. The Following User Says Thank You to birdman For This Useful Post:

    kryton (05-05-17)

  11. #9
    dsayers's Avatar
    Title
    ViX Beta Tester
    Join Date
    Mar 2016
    Posts
    1,761
    Thanks
    473
    Thanked 607 Times in 433 Posts
    I'm pretty sure you could try to remove the script as there is individual scripts in etc/enigma2 to update bouquets on boot. The crontab then downloads the epg.xml files daily

  12. The Following User Says Thank You to dsayers For This Useful Post:

    kryton (05-05-17)

  13. #10

    Title
    Forum Supporter
    Donated Member
    Join Date
    Jul 2013
    Posts
    150
    Thanks
    14
    Thanked 24 Times in 20 Posts
    Quote Originally Posted by kryton View Post
    in the script.sh1 file on the root of the box there is a line wget -0 /etc/cron/crontab/root....with an http:// adress before it.
    so this must be the line thats downloading and over writing the root file in crontab.
    no >> though.
    anyway to amend this so it does not completely over write the root file?
    Hi Krypton - was about to reply along the lines of - Yes that line is the culprit with the -O option overwriting the file so change it to -O /tmp/cronfile.mine and then do a cat /tmp/cronfile.mine /etc/cron/crontab/root | uniq > /tmp/out && mv /tmp/out /etc/cron/crontab/root BUT then I noticed birdman's more exquisite answer utilising awk to parse the file to preserve the original. Go with his! Bourne admiration!

  14. The Following User Says Thank You to iwg For This Useful Post:

    kryton (05-05-17)

  15. #11
    dsayers's Avatar
    Title
    ViX Beta Tester
    Join Date
    Mar 2016
    Posts
    1,761
    Thanks
    473
    Thanked 607 Times in 433 Posts
    Should be sorted now he's removed the script for crontabs and just has the epg.xml files to download on boot if its the same source

  16. The Following 2 Users Say Thank You to dsayers For This Useful Post:

    Bangord30 (05-05-17),kryton (05-05-17)

  17. #12

    Title
    Senior Member
    Join Date
    Aug 2015
    Posts
    234
    Thanks
    131
    Thanked 68 Times in 50 Posts
    Thanks for your help gentlemen.
    Deleting the script.sh1 file from the root certainly did the trick.
    The script file is written back to the root after a reboot but it no longer contains the line wget -0 /etc/cron/crontab/root

    so now after a reboot my cron timer is still there and epg and bouquets still update as they should.
    the wget line must be from the initial installation

    i hope this helps No1gooner too.

    thanks again
    Last edited by kryton; 05-05-17 at 22:25.

  18. #13
    dsayers's Avatar
    Title
    ViX Beta Tester
    Join Date
    Mar 2016
    Posts
    1,761
    Thanks
    473
    Thanked 607 Times in 433 Posts
    Quote Originally Posted by kryton View Post
    Thanks for your help gentlemen.
    Deleting the script.sh1 file from the root certainly did the trick.
    The script file is written back to the root after a reboot but it no longer contains the line wget -0 /etc/cron/crontab/root

    so now after a reboot my cron timer is still there and epg and bouquets still update as they should.
    the wget line must be from the initial installation

    i hope this helps No1gooner too.

    thanks again
    No the cron script was removed this morning so when you rebooted it would have removed the cron script aswell the epg.xml files now just download on boot

  19. The Following User Says Thank You to dsayers For This Useful Post:

    kryton (06-05-17)

  20. #14

    Title
    Senior Member
    Join Date
    Aug 2015
    Posts
    234
    Thanks
    131
    Thanked 68 Times in 50 Posts
    Quote Originally Posted by dsayers View Post
    No the cron script was removed this morning so when you rebooted it would have removed the cron script aswell the epg.xml files now just download on boot
    ah yes sorry i mis-understood your earlier post (#11)
    was this fix a coincidence or had you informed the source about the problem? if you did....thankyou.

  21. #15
    dsayers's Avatar
    Title
    ViX Beta Tester
    Join Date
    Mar 2016
    Posts
    1,761
    Thanks
    473
    Thanked 607 Times in 433 Posts
    No I didn't inform them someone else must have but at least it's sorted. My other crontimer was only running a small script that didn't make much of a difference if it didn't run so I wasn't too bothered about it.

    Sent from my SM-G925F using Tapatalk
    Using a Vu+Uno4k using a sundtek DVB-S/S2 USB tuner with vix 6.4 developer image

  22. The Following User Says Thank You to dsayers For This Useful Post:

    kryton (06-05-17)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
This website uses cookies
We use cookies to store session information to facilitate remembering your login information, to allow you to save website preferences, to personalise content and ads, to provide social media features and to analyse our traffic. We also share information about your use of our site with our social media, advertising and analytics partners.