I created a little daemon service
in Ubuntu
which works pretty well, I have a question about the crash of my application.
This service execute an app that I developed, but could happen that this app will crash, so I need to restart it automatically.
Inside the service I wrote:
[Unit]
Description = Hello World Daemon
[Service]
ExecStart = /usr/bin/dotnet /home/my username/Desktop/publish/SimpleApp.dll
Restart = on-failure
[Install]
WantedBy = multi-user.target
as you can see I have Restart = on-failure
I want to know if this line is enough to restart the service automatically when the app crash. Thanks.
[Unit]
...
[Install]
...
[Service]
...
...
Restart=always
RestartSec=3
...
The value of the Restart parameter is set to always. This means service will restart for clean or unclean exit codes or timeouts. That's where an automatic restart is defined in systemd.
Restart = always
这应该够了吧。
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.