pimoroni / clean-shutdown

Python daemon to watch a GPIO pin and trigger a clean shutdown.
MIT License
125 stars 40 forks source link

Modify start and stop to use start-stop-daemon #7

Closed ngreatorex closed 6 years ago

ngreatorex commented 7 years ago

Currently, the start command never forks, so it never returns, and just times out after 5 minutes. This PR changes the init script to use the dpkg provided start-stop-daemon.

neil@raspberrypi:~ $ sudo systemctl status cleanshutd
● cleanshutd.service - LSB: Monitoring GPIO shutdown trigger
   Loaded: loaded (/etc/init.d/cleanshutd)
   Active: failed (Result: timeout) since Sat 2017-07-15 19:52:57 UTC; 51s ago
  Process: 3685 ExecStart=/etc/init.d/cleanshutd start (code=killed, signal=TERM)

Jul 15 19:47:57 raspberrypi cleanshutd[3685]: Starting...
Jul 15 19:47:57 raspberrypi su[3689]: Successful su for root by root
Jul 15 19:47:57 raspberrypi su[3689]: + ??? root:root
Jul 15 19:47:57 raspberrypi su[3689]: pam_unix(su:session): session opened for user root by (uid=0)
Jul 15 19:47:57 raspberrypi cleanshutd[3685]: monitoring BCM 4
Jul 15 19:52:57 raspberrypi systemd[1]: cleanshutd.service start operation timed out. Terminating.
Jul 15 19:52:57 raspberrypi systemd[1]: Failed to start LSB: Monitoring GPIO shutdown trigger.
Jul 15 19:52:57 raspberrypi systemd[1]: Unit cleanshutd.service entered failed state.
Gadgetoid commented 6 years ago

Thank you, I need to look properly into this, and into creating a systemd unit to properly support modern versions of Raspbian.

ozgurbutu commented 6 years ago

Same issue with latest raspbian stretch. start-stop-daemon works. Thank you.

Gadgetoid commented 6 years ago

Merging this for now pending a look into rewriting this with Python and as a systemd unit. Thank you!