vailixi Posted August 18, 2018 Share Posted August 18, 2018 (edited) 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: myservice.service: Main process exited, code=exited, status=127/n/a systemd: 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. [Unit] Description=My Application After=network.target [Service] Type=simple PIDFile=/run/myapplication.pid ExecStart=/bin/myapplication ExecReload=/sbin/start-stop-daemon [Install] WantedBy=multi-user.target Then restarting the daemon with systemctl daemon-reload. Edited August 20, 2018 by vailixi Quote Link to comment Share on other sites More sharing options...
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.