How to convert my program into a service?

Bo Berglund bo.berglund at gmail.com
Tue Mar 30 10:35:58 UTC 2021


On Tue, 30 Mar 2021 11:48:40 +0200, Bo Berglund <bo.berglund at gmail.com> wrote:

>On Tue, 30 Mar 2021 10:02:15 +0200, Bo Berglund <bo.berglund at gmail.com> wrote:
>
>>Is there a authoritative howto document which describes how this should be done
>>including where to put which files?
>
>I'd probably rephrase that as:
>
>Is there a simple "for dummies" howto document...
>
>Anyway I have waded through a lot of google suggestions and then found this,
>which seems to be good enough while not throwing me off a cliff...
>
>https://www.howtogeek.com/687970/how-to-run-a-linux-program-at-startup-with-systemd/
>
>I will do some trial-and-error tests using this and see where I get.
>
>My application spawns a number of threads so I guess I have to use this:
>[Service]
>KillMode=mixed
>
>OTOH, when I run the program from the command line I can shut it down using
>Ctrl-C in the terminal.
>Or using kill -9 <pi< from another terminal.
>

Additional question:
If the program is running as the ssytemd service and it needs to be updated, can
I then do:
1) Replace the executable file in place (while it is running)
2) Command systemd to restart the service

I have noted that Linux does not protest if I remove a program when it is
running so I assume unlike Windows Linux loads the full program into memory at
start and does not need the file anymore?

-- 
Bo Berglund
Developer in Sweden





More information about the ubuntu-users mailing list