I have a service that has ability to update itself. After the service got update it should be restarted.
So workflow steps:
- Service downloads some updates
- Modify itself (executable file)
- Start new process (fork itself)
- Shutdown current process
- 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.