Is it possible somehow to run a script/program on shutdown?
Like the startup script is starting the daemons, I would like to run a small script before the device shuts down.
I could write a daemon which checks for my signal all the time, but this seems to be very wasting of resources, since this only will happen very seldom.
To give some more details:
I need to change a parameter in a config file. since this is only possible as root, the only way I know to do it, is by a script started by the system itself, i.e. as a daemon.
The problem is: the change of the config file is only taken by the system after a reboot. So I would like to change the parameter and do a restart. If I only can change the parameter in a daemon, I would have to reboot twice (once to change parameter, then for the system to take the changed parameter).
In the daemon documentation at http://harmattan-dev.nokia.com/docs/...g_daemons.html it sais this:
Would pre-stop do what I need?
# If you need to do preparations, you can use normal Upstart stanzas
# such as pre-start, post-start, script, pre-stop and post-stop sections
# Start myapp as root
How would I have to use it?