Execute command at boot

  • Hello,


    I want to execute this command at each boot in my DM500S:


    Code
    /sbin/rdate -s time.mit.edu


    How could I do this?


    Thanks and best regards.

  • look in folder/etc/init.d

  • Hi,


    I have the same problem... I want to execute a script at boot but when I try to edit /etc/init.d it says: Can not create or edit - read only file system.


    Am I doing something wrong?

  • DM500s with Gemini 4.2


    Actually I want to put the box to standby after every boot.
    I found this command:


    wget -q -O - "http://127.0.0.1/cgi-bin/admin?command=standby"


    and it does work, I just don't know how to run this after every boot.

  • Did you try the plugin enigma2-plugin-extensions-startuptostandby? This works fine.
    disatvantage: the box will got to standby after every enigma2 restart too.


    If you want to resolve it by using a shell script you have to be "tricky".


    Check in your script an existtng controlfile, e.g. /tmp/on.boot.done


    if this file does not exist, create it and send the box to standby with the wget commad. This will be done when booting. If the control file still exist do nothing. By checking such a controlfile the script should send the box to standy on bootup only

    Gruß Fred


    Die Dreambox ist tot, es lebe die Dreambox


    Einmal editiert, zuletzt von Fred Bogus Trumper ()

  • 500S think that's an Enigma box


    don't think enigma2-plugin-extensions-startuptostandby will be possible


    or do I miss something?


    EDIT
    little too slow :winking_face:

  • oh, sorry


    but it is the same solution - but einigma1 is long ago ...
    to add a script on bootup on a 500s is a little bit more difficult as on boxes running with enigm2 - in case parts of the flash are read only. But thery are posibillites ...


    The next problem is to find the correct timing. If the standby command will be send before the Web-IF startup it doesn' t work.


    As it is diffucult to find the right timing without try and error you can resolve it with a loop checking the Web-IF is reachable in your script. If not, wait eg. 10 seconds then try again. If it is reachable send the standby command and exit the script. But he loop must run in backgroud to avoid a long bootup time!

    Gruß Fred


    Die Dreambox ist tot, es lebe die Dreambox


    2 Mal editiert, zuletzt von Fred Bogus Trumper ()

  • https://www.i-have-a-dreambox.…hread.php?threadid=118699
    /var/etc/init

    Code
    sleep 120 && wget -q -O - "http://127.0.0.1/cgi-bin/admin?command=standby" &


    sleep is needed because wget works only when the web interface (a part of enigma binary) is loaded, make init executable with

    Code
    chmod 755 init


    in this case init script doesn´t start with !!!
    #!/bin/sh


    mrvica

  • Thanks! :hurra:


    That was the problem... the Webif was not running when the command was issued.


    sleep 5
    wget -q -O - "http://127.0.0.1/cgi-bin/admin?command=standby"


    Works :408:


    Thank you everyone!

  • I think sleep 120 is ok


    executed in a background loop with "sleep 10" will send the box to standby when the Web-IF is reachable. In case the bootup needs more than 120 seconds your solution don't work - that what i meened in my above post with "correct timing".

    Gruß Fred


    Die Dreambox ist tot, es lebe die Dreambox


    Einmal editiert, zuletzt von Fred Bogus Trumper ()