Difference between revisions of "Redhat - fedora service startup"
(→=adding new services) |
(→adding new services) |
||
Line 55: | Line 55: | ||
example | example | ||
− | # '''chkconfig --add | + | # '''chkconfig --add snmpd''' |
error reading information on service badserviced: Invalid argument | error reading information on service badserviced: Invalid argument | ||
Line 66: | Line 66: | ||
# '''chkconfig --list | grep nrpe''' | # '''chkconfig --list | grep nrpe''' | ||
nrpe 0:off 1:off 2:off 3:off 4:off 5:off 6:off | nrpe 0:off 1:off 2:off 3:off 4:off 5:off 6:off | ||
− | |||
===setting the run levels=== | ===setting the run levels=== |
Latest revision as of 16:31, 13 October 2014
Contents |
run levels
Service start and stop scrips are associated with run levels 0-6. Each has a corresponding directory in /etc/rc.d. For each run level, a script beginning with K stops the service, whereas a script beginning with S starts the service.
starting services on boot
In order to start it automatically on every system boot, run
# systemctl enable sshd.service
Likewise, you can remove it from system startup
# systemctl disable sshd.service
If you would like to see a list of all available managed services, run
# systemctl -a
chkconfig method
listing existing services
listing existing services and the run level start configurations
# chkconfig --list
example:
# chkconfig --list | grep sshd sshd 0:off 1:off 2:on 3:on 4:on 5:on 6:off
corresponding start/stop scripts
# grep -r -m 1 sshd /etc/rc.d/* | sort -n /etc/rc.d/init.d/sshd:# processname: sshd /etc/rc.d/rc0.d/K25sshd:# processname: sshd /etc/rc.d/rc1.d/K25sshd:# processname: sshd /etc/rc.d/rc2.d/S55sshd:# processname: sshd /etc/rc.d/rc3.d/S55sshd:# processname: sshd /etc/rc.d/rc4.d/S55sshd:# processname: sshd /etc/rc.d/rc5.d/S55sshd:# processname: sshd /etc/rc.d/rc6.d/K25sshd:# processname: sshd
adding new services
adding a new service if isn't already listed.
# chkconfig --add <name>
name = service name as its start script appears in /etc/init.d/ or you will get an error
example
# chkconfig --add snmpd error reading information on service badserviced: Invalid argument
example...
# chkconfig --add snmpd
check service just added, notice all run levels will be off by default
# chkconfig --list | grep nrpe nrpe 0:off 1:off 2:off 3:off 4:off 5:off 6:off
setting the run levels
# chkconfig --level <levels> <name> on
example, setting levels 2-5...
# chkconfig --level 2345 snmpd on
misc info
# chkconfig sshd on
on fedora 17, the above command creates a symlink in a subdir of /etc/systemd/system/