resilient shutdown- and maybe startup-scripts

  • Hi

    Maybe I am only too stupid to find out how it actually works, but I'd like to have a script that will be executed while shutdown, which is not overwritten by Systemupdates.

    This could be used to send Commands to external components like home automation, receivers, e.g.

    The other way (sending commands during startup) would also be nice, but is at least for me not that important since my HTPC is not reestablishing HDMI after failed Hardware-Test ( for the Receiver to provide a virtual monitor)

    The change should not be too big (e.g. a link to specific file in the Samba accessible Share)

    What do you think - could this be possible ?!?

    Kind Regards
    Frank

  • No text...?autostart.shautostart.sh is run on system startup. It can be used to run commands before XBMC/Kodi starts. To create it simple use nanonano /storage/.config/autostart.sh
    This script will hold up the boot process until it has completed, so if you want it run in the background the contents of your script should be encase like this(
    some commands;
    some more commands
    ) &
    You can also access the file via the configfiles samba share.http://shutdown.sh/storage/.config/shutdown.sh
    Depending on when you want your commands to run you need to put them in the proper location, or under the *) case if you want it run for any.case "$1" in
    halt)
    # your commands here
    ;;
    poweroff)
    # your commands here
    ;;
    reboot)
    # your commands here
    ;;
    *)
    # your commands here
    ;;
    esac
    [hr]
    Crap... The editor is fcuking up the marked up text.

    Edited once, last by Klojum (July 10, 2016 at 12:36 PM).

  • The wiki page I posted contains information for both "autostart.sh" and "shutdown.sh", and it works fine.

    So it's a layer 8 problem and the solution is simple: exchange the user for a competent one.

  • Hi Klojum
    Sorry, I didn't get that....

    You mean I only need to generate a shutdown.sh in sambashare\Configfiles, and that will be used automagically ???
    That would be perfect - can you confirm?

    $1 will then be defined by the shutdown option that is selected in Kodi ??

    Is there anything else I need to take care of, or can I just add the Case after #!/bin/sh (In case I don't want to run general commands, which I do not want to)

    Thanks in advance
    Frank

    P.S. My first comment to autostart.sh was that the link was referring to an empty page...
    [hr]


    The wiki page I posted contains information for both "autostart.sh" and "shutdown.sh", and it works fine.

    So it's a layer 8 problem and the solution is simple: exchange the user for a competent one.

    Retried and it works now, kudos, it seems that they did some maintenance on the wiki - No pun intended, no need being rude (Layer 9 problem)
    [hr]


    fzwo: I think this thread is what you are looking for.

    Hi, vpeter

    Thanks, but this is what I wanted to avoid, since I expect any changes in systemctl will be overwritten by the next update.

    So if the the shutdown.sh solution would work, this would be perfect for me.
    So I think I will be patient (at the moment it is a two click versus a one click shutdown)...

    Thanks, Frank

    Edited once, last by fzwo (July 10, 2016 at 2:19 PM).