From 904d7fd959a5dcb9d4ae45785ab364d3bd8e386a Mon Sep 17 00:00:00 2001 From: "Begerad, Stefan" Date: Wed, 15 Mar 2023 22:25:11 +0100 Subject: [PATCH] feat: add systemd service script --- etc/systemd/system/rgncycle.service | 37 +++++++++++++++++++ etc/systemd/system/rgncycle.service.restart | 41 +++++++++++++++++++++ 2 files changed, 78 insertions(+) create mode 100644 etc/systemd/system/rgncycle.service create mode 100644 etc/systemd/system/rgncycle.service.restart diff --git a/etc/systemd/system/rgncycle.service b/etc/systemd/system/rgncycle.service new file mode 100644 index 0000000..e341cee --- /dev/null +++ b/etc/systemd/system/rgncycle.service @@ -0,0 +1,37 @@ +# +[Unit] + +# describe the service +Description=rgncycle libulfius api + +# +After=syslog.target + +# define details that the os requires to be able to start the service +[Service] + +# specify the security details for the app to run +User=rgncycle +Group=rgncycle + +# simple: the app will run immediately without forking any other processes +Type=simple + +# specify the entire command line to be used to execute the app +ExecStart=/home/rgncycle/git/rgncycle-libulfius/http-get/main 65535 cfg-sib00_rgncycle.txt + +# define that the app has closed cleanly with exit status 143 when killed via SIGTERM +SuccessExitStatus=143 + +# define the service home directory +WorkingDirectory=/home/rgncycle/git/rgncycle-libulfius/http-get + +# restart the service after a failure +Restart=on-failure +RestartSec=10s + +# tell if the app is configured to start at boot time +[Install] + +# +WantedBy=multi-user.target diff --git a/etc/systemd/system/rgncycle.service.restart b/etc/systemd/system/rgncycle.service.restart new file mode 100644 index 0000000..e76ac01 --- /dev/null +++ b/etc/systemd/system/rgncycle.service.restart @@ -0,0 +1,41 @@ +# +[Unit] + +# describe the service +Description=rgncycle libulfius api + +# +After=syslog.target + +# define details that the os requires to be able to start the service +[Service] + +# specify the security details for the app to run +User=rgncycle +Group=rgncycle + +# simple: the app will run immediately without forking any other processes +Type=simple + +# specify the entire command line to be used to execute the app +ExecStart=./main 65535 ./cfg-sib00_rgncycle.txt + +# define that the app has closed cleanly with exit status 143 when killed via SIGTERM +SuccessExitStatus=143 + +# define the service home directory +ExecStart=/home/rgncycle/git/rgncycle-libulfius/http-get/main 65535 cfg-sib00_rgncycle.txt + +# restart the service after a failure +#Restart=on-failure +#RestartSec=10s + +# restart the service after RuntimeMaxSec is reached +RuntimeMaxSec=600s +Restart=always + +# tell if the app is configured to start at boot time +[Install] + +# +WantedBy=multi-user.target