I am developing for Linux and have a daemon that should write to disk when it is killed. The daemon could be configured to listen to SIGTERM and write to disk when that signal is received. I am also familiar with the PrepareForShutdown D-Bus signal issued by the login manager (http://www.freedesktop.org/wiki/Software/systemd/logind/).
I'm trying to get a graceful shutdown/reboot in ArchLinux with GNOME Shell. Now, when I ask for shut-down, it immediately shuts down without giving open programs time to gracefully close / save open files.
I have written a shell script to check the specific program is run or not,i have put shell script into crontab where it have schedule for every 1 min .Suppose to program is not run, that time script start the program.On other hand one more situation where my program is running in this particular time my cronjob continuously run.
Here i'm seeing shell script taking show much cpu utilization and it