Jump to content

Create a system service on Linux


Recommended Posts

I was wondering how does one go about creating system service on Ubuntu.

What goes in the unit file and what other files are required and what other commands are needed to make this happen?

I searched this and found a bunch of tutorials that don't work. Just get a bunch of error codes.

systemd[1]: myservice.service: Main process exited, code=exited, status=127/n/a
systemd[1]: myservice.service: Failed with result 'exit-code'.

. I saw a tutorial that showed a script that assigned a process id that could be killed to stop the service. That also didn't work for me. What is the correct way to do this?

Update. I figured this out. It was a matter of creating a .service file in /etc/systemd/system/ with a few lines.

Description=My Application



Then restarting the daemon with systemctl daemon-reload.

Edited by vailixi
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...