So, you have a service running on server startup that you need to stop running. Here is how I stop a service from running on startup on Centos (Red Hat) using chkconfig.
From the command line run
to show all the services, including their run level. You can list the run levels for a particular service, in this case, mysqld, by doing this:
chkconfig –list mysqld
You should get something that looks like this:
mysqld 0:off 1:0ff 2:on 3:on 4:on 5:on 6:off
Now you can use chkconfig to turn off (or on) the services for the specific run levels. Here we will turn off the mysqld (not that I recommend doing that on your webserver):
I recommend making a note of what they were before you change them. Just in case.
chkconfig –level 2345 mysqld off
to turn it back on again
chkconfig –level 2345 mysqld on
“Hey, what are those run-level things all about?” you might ask. Here is a quick overview of the Centos runlevels.
- single user mode (no network, just root user)
- multi-user mode (no network)
- multi-user mode with networking (most common – you’ll need a network for your webserver, eh )
- undefined (user-definable boot state)
- X11 (X windows System – if used as workstation or desktop – most webservers won’t be doing this)
- reboot (probably will never want this)
oh and “0” is the halt runlevel (when the system shuts down, you won’t want this either)