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

I have been wondering if issuing a reboot command safely stops running LAMP processes like MySQL or Apache?

share|improve this question
What system are you on? – Runium Jun 16 '13 at 6:08
CentOS 6.2 (the latest). – giorgio79 Jun 16 '13 at 6:09
up vote 5 down vote accepted

If it's installed as a service (most likely case), it should get the command to stop on the way down automatically.

If it's not, then you should stop them first.

Edit: Now that I have a few minutes at a computer, I'll expand on this a bit.

One way to view your available services is to use the service command (typically /sbin/service)

As root (or using sudo or a similar command) you can use the following:

# service --status-all
# service --status-all | grep httpd
# service --status-all | less
# service httpd status

You can also use the chkconfig command (again as root)

# chkconfig --list
# chkconfig | grep httpd
# chkconfig --list | less

If the applications were installed during OS installation or via yum this will most likely by the case for you and they will stop when the OS is shutting down or rebooting.

If they were installed via some non-standard way and not as a service, then it would be best to stop them first, otherwise the OS will forcefully stop them before shutting down (killall)

share|improve this answer

Sometimes (not on Linux, though) there's a difference between a reboot initiated by reboot command and orderly shutdown & reboot (shutdown -r); the latter runs any shutdown scripts, the former doesn't and kernel simply terminates all running processes (forcibly with SIGKILL, if need be)

share|improve this answer
I know this is the case in older (over 10 years ago) Unix systems (hp-ux, Solaris, aix). I haven't work with the newer versions of them, is it still true? – pferate Jun 16 '13 at 21:12

They don't need to be stopped per se, but they need to know that they have to flush all current writes to disk and switch to read-only. It just so happens that stopping them prevents them from writing any more to the disk by default (since they no longer exist). Most shutdown processes stop any running daemons.

share|improve this answer

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.