System Services and Runlevels

System Services

Systemd is a system and service manager for Linux Operating
System.

Systemd is designed to work with SysV init scripts, and have
some features like start up of services on boot, on demand etc.

You can easily stop, start and check any service status of
Linux Operating System.

Systemd has replaced init from Redhat 7.  

The SysV init is a process used by RHEL to control which
software the init command launches or shuts off on a given
runlevel.

Each runlevel has its directory in /etc/ as “/etc/rcX.d/” and
has symlinks in /etc/init.d/. You can view scripts using
“ls –l /etc/rc0.d/” etc.

Most used command line parameters for init scripts.
  • start – start the service.
  • stop – stop the service.
  • status – check status of service stopped or running.
  • relaod – reload changed configuration.
  • restart – retstart your service.
Example:

# systemctl status sshd		(sshd is service name, It will give you status. You can use above parameters as per requirement)	
Runlevels

A runlevel is a way of operation of Linux OS where it uses SysV
init scripts.

You can say it is a state of machine after boot.
Some Important commands related to runlevels
# ls /lib/systemd/system/runlevel*target –l		(To view all runlevels link path)

# ln -sf /lib/systemd/system/runlevel5.target /etc/systemd/system/default.target	(It will change default runlevel to runlevel 5, a reboot is 							required for that)	
# systemctl get-default			(To check current runlevel)

# systemctl set-default multi-user.target  	(It will change default runlevel to multi-user, a reboot is required for that and after reboot you 				can check default using above command)

# systemctl isolate multi-user.target 		(You can switch runlevel with command line)

Leave a Reply

Your email address will not be published. Required fields are marked *