Announcement

Collapse
No announcement yet.

Linux novice asking for shutdown script help!

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Linux novice asking for shutdown script help!

    I’ve got an HS3Pi working at a remote location, so startup/shutdown/reboot etc is automated. Every night the Pi shuts down via cron, the power is switched off using a mechanical timer and then on again a few minutes later causing HS3 to restart. Thus if the Pi crashes completely there’s a good chance it will come on again the next day.

    However, it seems from experience so far that HS3 is not 100% happy about not being shutdown gracefully before the Pi shuts down. So that’s what I’m trying to achieve. But because HS3 is running as a screen session my limited Linux abilities are not enough to get the correct syntax.

    my startup line in rc.local is
    screen -d -m ./usr/share/scripts/startup.sh

    and startup.sh invokes the ‘go’ command. This all works fine.


    When I shut HS3 down manually I type

    sudo screen -r (there’s only one screen session working, so nothing else is needed)
    shutdown

    then press enter.

    So those are the lines I’m trying to recreate in a script so I can run them as an HS3 event. Please would someone be kind enough to point me in the right direction? The ‘screen’ operators and ‘stuff’ commands are proving a little hard to get my head round! Thanks!

    #2
    The only way I've found to perform a clean shutdown is to send the hs.shutdown() script command to the control panel thru the web interface. Services in Linux are generally controlled by various "signals". As HS3 isn't implemented as a proper service, this doesn't work; sending it any signal results in an immediate exit (i.e. "crash").

    See this thread: https://forums.homeseer.com/forum/ho...taller-package

    This implements HS3 as a Linux service. Stopping the service performs an orderly shutdown. An HS event can be setup to perform a shutdown, or a shutdown followed be a system reboot.

    To shutdown HS3,
    event action is: Run another program or process
    program is: /usr/bin/service
    parameters: homeseer stop

    For shutdown then reboot:
    event action is: Run another program or process
    program is: /sbin/reboot
    No additional parameters.

    Comment


      #3
      Thanks for replying. I’m really sorry, I may have misled you. What I have is not a Homeseer Pi image, it is ZeeTroller software grafted onto a pre-existing Jessie OS, using an HS3Pi license. I hadn’t realized until now that this makes a big difference. Because I’m running HS3 as a screen session, I think I need a simpler version of the shutdown script (the section starting service_stop) shown in this post.

      https://forums.homeseer.com/forum/ho...949#post905949

      Comment

      Working...
      X