Start a service
// take httpd for example
/etc/rc.d/init.d/httpd start // method 1
service httpd start //method 2
chkconfig FOR "AUTO START SERVICE"
chkconfig --list
┌─[root@nedrain]─[~]
└──? $chkconfig --list
aegis 0:off 1:off 2:on 3:on 4:on 5:on 6:off
netconsole 0:off 1:off 2:off 3:off 4:off 5:off 6:off
network 0:off 1:off 2:on 3:on 4:on 5:on 6:off
chkconfig --level [run level] [service name] [on | off]
it will affect at next reboot, not this time
chkconfig --level 2345 httpd on // turn the httpd service on at 2, 3, 4, 5 run levels
you can alse edit the file "/etc/rc.d/rc.local", also auto run
RECOMMENDED, cause this way can also work on service installed by source code package
vim /etc/rc.d/rc.local
// the output
#!/bin/bash
# THIS FILE IS ADDED FOR COMPATIBILITY PURPOSES
#
# It is highly advisable to create own systemd services or udev rules
# to run scripts during boot instead of using this file.
#
# In contrast to previous versions due to parallel execution during boot
# this script will NOT be run after all other services.
#
# Please note that you must run ‘chmod +x /etc/rc.d/rc.local‘ to ensure
# that this script will be executed during boot.
touch /var/lock/subsys/local
/etc/rc.d/init.d/httpd start // auto start the httpd service after reboot