I have a bash script that is supposed to execute on reboot/shutdown of a remote Ubuntu server, connected over SSH:
ls /etc/rc{0,6}.d/k99*
/etc/rc0.d/k99_stop_all /etc/rc6.d/k99_stop_all
The script needs about 3 min to finish.
How can I ensure the reboot/shutdown only happens on successful execution of k99_stop_all
?
Does sudo shutdown -r 10
starts execution of the script scheduled for reboot?