Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

With fedora 15 or 16, I don't find the directory for execute a shell script automaticaly at shutdown...

share|improve this question

Fedora 16 has replaced the legacy "System V" style init scripts -- which let you run scripts at startup and shutdown via scripts in /etc/rc.d -- with systemd. You can create a systemd service file that runs a shell script when it starts and stops, much like a traditional init script. Put something like the following in /lib/systemd/system/runonshutdown.service:

ExecStart=/path/to/myscript start
ExecStop=/path/to/myscript stop


With this in place, you can then run:

# chkconfig runonshutdown on
ln -s '/lib/systemd/system/runonshutdown.service' '/etc/systemd/system/multi-user.target.wants/runonshutdown.service'

When your system boots, it will run /path/to/myscript start, and when your system shuts down, it will run /path/to/myscript stop.

For more information, read the systemd.service(5) man page.

share|improve this answer
Thank you, i use it on 2 fedora 16 – Pierre Feb 22 '12 at 17:55
I'm glad it helped out. If this answer did solve your problem, it would be great if you could mark it as "accepted" by clicking the checkbox to the left of the answer. Thanks! – larsks Feb 22 '12 at 20:49

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.