Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

How does one get certain daemons to automatically startup on a restart of the server?

I found this post on Server Fault but I am looking of a more in depth explanation of how getting a daemon to auto start works.

I am using CentOS v5.8 and I am trying to get MySQL and Apache to start by default after a restart of the system. Does it involve changing a configuration file?

share|improve this question

migrated from serverfault.com Sep 24 '12 at 20:02

This question came from our site for professional system and network administrators.

2 Answers 2

up vote 2 down vote accepted

A daemon is a background process - often called service, too.

Which services are started at what runlevel is defined in directories and links located at /etc/init.d.

The cli-frontend for managing these services is chkconfig.

If you look into the header of some scripts located at /etc/init.d you see some numbers. Some define the runlevel, where the services should be started, other the order-number when - within that level - it should be started and another when it should be stopped. The rc scripts (called via init and its configuration file /etc/inittab) do the magic calls of theses scripts when reaching/changing runlevels.

share|improve this answer

If you installed both MySQL and Apache from the CentOS 5 repository, they should have installed start/stop scripts under /etc/init.d. You use chkconfig to manage which services are started after the system boots.

# chkconfig --list httpd
httpd           0:off   1:off   2:off   3:off   4:off   5:off   6:off
# chkconfig httpd on
# chkconfig --list httpd
httpd           0:off   1:off   2:on    3:on    4:on    5:on    6:off

The numbers correspond to the different runlevels.

share|improve this answer

Your Answer

 
discard

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.