@peterG wrote:
Pi Zero W, Debian 9 (Raspbian)
I want to be able to run a last text-write to my inkyphat when I shutdown my Pi. So far, I’ve tried a number of systemd entries that allegedly work (for other people), but not for me. Here’s the systemd entry that almost worked:
[Unit] Description=runs only upon shutdown Conflicts=reboot.target After=network.target [Service] Type=oneshot ExecStart=/bin/true ExecStop=/bin/bash /usr/local/bin/shutdown_screen RemainAfterExit=yes [Install] WantedBy=multi-user.target
And here’s shutdown_screen
#!/bin/bash # send a shutdown message only at shutdown (not at reboot) /usr/bin/systemctl list-jobs | egrep -q 'reboot.target.*start' || inkywrite.py "time to go"
I know this gets run by systemd, but I can’t get the shutdown to wait until the write has completed before it shuts down. Can anyone advise me here as I’m going round in circles :(
edit: I got the above from https://unix.stackexchange.com/questions/284598/systemd-how-to-execute-script-at-shutdown-only-not-at-reboot#284773
Posts: 3
Participants: 2