Sorry to bother you all with this question — can you please point me to a helpful document or give me some instructions on how to execute a script just before shutting down an Ubuntu system (Linux vijay-iMac 5.15.0-58-generic #64-Ubuntu SMP Thu Jan 5 11:43:13 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux)?
I created a simple script
-rwxr-xr-x 1 root root 51 Jan 30 11:46 /etc/init.d/before-shutdown
Then did a link so that I had
lrwxrwxrwx 1 root root 25 Jan 30 11:47 K04before-shutdown -> ../init.d/before-shutdown
Nothing happened!! So I wasted a lot of time reading up on systemd etc., and set up unit files to execute before shutdown.target, network.target, power off.target, as well as halt.target. Since these did not work either and life is too short, I went back to what I thought was the old way of doing things and did a
lrwxrwxrwx 1 root root 25 Feb 4 11:58 /etc/rc6.d/K99before-shutdown -> ../init.d/before-shutdown
This was a complete fail as well.
Would really appreciate any suggestions on how to make this work.
Thanks very much,
Vijay
Vijay Sankar ForeTell Technologies Limited vsankar@foretell.ca