systemd: service is able to restart by itself

Viewed 34

I have a service that has ability to update itself. After the service got update it should be restarted.

So workflow steps:

  1. Service downloads some updates
  2. Modify itself (executable file)
  3. Start new process (fork itself)
  4. Shutdown current process
  5. And so on, when new update is available go to 1.

Also I use systemd to prevent service crash, collect stdout logs etc.

How can I set up systemd to work well with this case? I tried:

Type=forking

But it does not work properly. When service creates fork process and stop main, systemd sends term signal to forked process.

0 Answers
Related