Update service files etc.

This commit is contained in:
Starbeamrainbowlabs 2018-12-27 14:05:40 +00:00
parent 7cbf1ef79c
commit 1314b3ab75
Signed by: sbrl
GPG key ID: 1BE5172E637709C2
2 changed files with 56 additions and 9 deletions

View file

@ -2,15 +2,58 @@
Description=RhinoReminds XMPP Bot Description=RhinoReminds XMPP Bot
After=network.target prosody.service After=network.target prosody.service
# No more than 5 crashes in 12 hours
StartLimitIntervalSec=43200
StartLimitBurst=5
[Service] [Service]
Type=simple Type=forking
# Another Type option: forking PIDFile=/run/rhinoreminds.pid
User=rhinoreminds # We change our own user
WorkingDirectory=/srv/rhinoreminds User=root
ExecStart=/srv/rhinoreminds/start_service.sh WorkingDirectory=/srv/kraggwapple
ExecStart=/srv/kraggwapple/start_service.sh
Restart=on-failure Restart=on-failure
# Other Restart options: or always, on-abort, etc # Other Restart options: or always, on-abort, etc
# Delay restarts by 60 seconds
RestartSec=60
[Install] [Install]
WantedBy=multi-user.target WantedBy=multi-user.target
[Unit]
Description=Kraggwapple XMPP Bot
After=network.target prosody.service
# No more than 5 crashes in 12 hours
StartLimitIntervalSec=43200
StartLimitBurst=5
[Service]
Type=forking
PIDFile=/run/kraggwapple.pid
# We change our own user
User=root
WorkingDirectory=/srv/kraggwapple
ExecStart=/srv/kraggwapple/start_service.sh
Restart=on-failure
# Other Restart options: or always, on-abort, etc
# Delay restarts by 60 seconds
RestartSec=60
[Install]
WantedBy=multi-user.target

View file

@ -1,8 +1,12 @@
#!/usr/bin/env bash #!/usr/bin/env bash
source .xmpp_credentials cd data;
source .xmpp_credentials;
export XMPP_JID; # Execute & disown
export XMPP_PASSWORD; # We pass the environment variables explicitly here, as then we don't accidentally pass something private.
# Better to be safe than sorry - defence in depth!
sudo -u username_here XMPP_JID="${XMPP_JID}" XMPP_PASSWORD="${XMPP_PASSWORD}" /usr/bin/mono RhinoReminds.exe --domain starbeamrainbowlabs.com
echo "$!" >/run/rhinoreminds.pid;
disown;
exec /usr/bin/mono RhinoReminds.exe --domain starbeamrainbowlabs.com