Skip to content

How to make a custom systemd service

Last updated: October 20, 2021

Basic systemd commands:

  • systemctl status: Show status of all systemd service
  • systemctl daemon-reload: Reload systemd if units are modified
  • systemctl enable: to enable a new service
  • systemctl start: to start a new service
  • systemctl restart: to restart a service

Example service file

  1. Make new service unit file in /etc/systemd/system/new-service.service:

    Description = Sensai background service
    After =
    ExecStart = /usr/bin/python3 /home/lento/projects/sensai/
    User = lento
    Group = lento
    WantedBy =
  2. Reload systemd and enable the service

    systemctl daemon-reload
    systemctl enable new-service.service
  3. Start the new service

    systemctl start new-service.service
  4. Inspect the status

    systectl status new-service.service

Last update: March 9, 2022