systemd
systemd is a software suite that provides an array of system components for Linux operating systems.
Its main aim is to unify service configuration and behavior across Linux distributions; systemd’s primary component is a “system and service manager”—an init system used to bootstrap user space and manage user processes. It also provides replacements for various daemons and utilities, including device management, login management, network connection management, and event logging. The name systemd adheres to the Unix convention of naming daemons by appending the letter d. It also plays on the term “System D”, which refers to a person’s ability to adapt quickly and improvise to solve problems.
All systemd
services reside in /etc/systemd/system
To create a new service create a file vi /etc/systemd/system/<service-name>.service
and then add the following to define the service.
In linux.rhel.7 this is the replacement for init.d.
[Unit]
Description=Description
After=network.target
[Service]
Type=simple
User=<user>
ExecStart=<script location>
Restart=on-failure
[Install]
WantedBy=multi-user.target
After
specifes what service to bring up this service afterExecStart
specifies the script to run to start the serviceWantedBy
specifies the level to run it at in this case multi-user.target means the service will start up when booting into multi-user mode.
Go to /etc/systemd/system and execute below enable command
systemctl enable <service-name>.service