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.

  • Wikipedia

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 after
  • ExecStart specifies the script to run to start the service
  • WantedBy 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

Contact

Content is copyrighted 2019-2023 © D.S. Chapman. This site was built using GatsbyJS. Code for this website is open source and available on Github