Create a Linux Systemd Service and make it runnable

Systemd is a Linux system tool that one of its features is bootstrapping start and manage system processes.

A systemd service makes it easy to start, stop, restart scripts as well as configure it to start at boot.

Create a systemd service

Suppose that we have a script in /usr/bin/ Also suppose that there is a Linux user named jdk in group ourgroup

  1. Create the file /etc/systemd/system/jdk.service and paste the following into it:
Description=Run myscript service as user jdk
ExecStart=/bin/bash /usr/bin/

2. Start the service to verify that it works: sudo systemctl start jdk.

3 . Enable the service so it runs on bootup: sudo systemctl enable jdk.

4. Restart your system and then verify that the MailHog service is running by running

    systemctl | grep jdk.

Facebook Comments

You may also like