Start an application using systemd

systemd is used to start applications on linux systems.

In this post, we will create an application and run start it on boot using systemd.

Lets create our sample application.

Add following content to the file and save.

You can start the application by running

on terminal, this will run a simple web server on port 80. If you already have a web server running on port 80, change the port to another.

To stop web server, type CTRL+C.

Create Systemd service file

To manage this application using systemd, we need to create a service file.

Add

systemd service file

Managing Systemd service

First you need to enable the service with

To start the service, run

To stop the service, run

To see status of the service, run

Add a Comment

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