@lackyluuk here is a simple example : https://github.com/recalbox/recalbox-buildroot/blob/rb-4.1.X/board/recalbox/fsoverlay/etc/init.d/S25lircd
All scripts are triggered at start with a start
argument, as well as at shutdown with a stop
argument.
A init skeleton script would look like this :
#!/bin/sh
start() {
}
stop() {
}
case "$1" in
start)
start
;;
stop)
stop
;;
restart|reload)
stop
start
;;
*)
echo "Usage: $0 {start|stop|restart}"
exit 1
esac
exit $?
You'd just need to populate the start and stop functions. In your case, the stop function only, and get rid of everything related to start or restart, so after all it would look like this :
#!/bin/sh
stop() {
}
case "$1" in
stop)
stop
;;
esac
You could even code everything in your stop)
case. Now you'd just need to call a python script to raise your gpio output to 1. Call your init.d script something like S99zled
so that you're sure it gets called first. The python part should be rather easy, but just say if you need some help.