I am currently running a script at startup using
/etc/rc.local. The problem is that during shutdown, it does not exit gracefully. This can cause (important) data loss. My script has a SIGINT handler to finish all jobs before exiting, is there any way to start the script during startup AND send a SIGINT to the script (and wait for it to finish) before shutdown?
Note: I could manually send a SIGINT to the script before shutting it down but I will not be administrating this server and there's no telling what someone in the future might do.