I just learned how to set the run level today. I used to do it manually, but creating symbolic links to the startup/shutdown script in /etc/init.d. But when I tried it on my newly setup system, I couldn't get it to work. Then I found how to use the chkconfig script. This is on my SuSe 10.0 environment. I read it works on Redhat too.
# chkconfig --list
This will list all services that are started up at boot time and what run level they are at.
# chkconfig --level 345 mysql.server on
This will set the MySQL server to start on run level 3, 4 and 5
# chkconfig mysql.server -list
This will list for an individual service
# chkconfig mysql.server -add
This will add a service and then you need to set the run time level using the --leve switch above
For example. I created this startup for apache, by copying the start up script supplied by apache, into the init.d directory:
#cp /usr/local/apache2/bin/apachectl httpd
# chkconfig httpd --add
httpd 0:off 1:off 2:off 3:on 4:off 5:on 6:off
# chkconfig httpd on --level 2,3,5
You can then see your newly added service when listing them all or individually, using the commands above.
# chkconfig --list
This will list all services that are started up at boot time and what run level they are at.
# chkconfig --level 345 mysql.server on
This will set the MySQL server to start on run level 3, 4 and 5
# chkconfig mysql.server -list
This will list for an individual service
# chkconfig mysql.server -add
This will add a service and then you need to set the run time level using the --leve switch above
For example. I created this startup for apache, by copying the start up script supplied by apache, into the init.d directory:
#cp /usr/local/apache2/bin/apachectl httpd
# chkconfig httpd --add
httpd 0:off 1:off 2:off 3:on 4:off 5:on 6:off
# chkconfig httpd on --level 2,3,5
You can then see your newly added service when listing them all or individually, using the commands above.
Comments