Commit mothd and its systemd service

This commit is contained in:
Neale Pickett 2017-07-14 22:56:09 +00:00
parent ff5a4bd13d
commit c56f704684
3 changed files with 33 additions and 1 deletions

View File

@ -7,7 +7,7 @@ else
fi fi
basedir=$(pwd) basedir=$(pwd)
printf "Updating moth instance in %s\n" $(pwd) [ -n "$DEBUG" ] && printf "Updating moth instance in %s\n" $(pwd)
# Do nothing if `disabled` is present # Do nothing if `disabled` is present
if [ -f disabled ]; then if [ -f disabled ]; then

14
tools/mothd Executable file
View File

@ -0,0 +1,14 @@
#! /bin/sh
cd ${1:-$(dirname $0)}
KOTH_BASE=$(pwd)
echo "Running koth instances in $KOTH_BASE"
while true; do
for i in $KOTH_BASE/*/assigned.txt; do
dir=${i%/*}
$dir/bin/once
done
sleep 5
done

18
tools/mothd.service Normal file
View File

@ -0,0 +1,18 @@
# To install:
# sudo cp mothd.service /etc/systemd/system/moth.service
# sudo systemctl enable mothd
# sudo systemctl start mothd
[Unit]
Description=Monarch Of The Hill server
After=network.target auditd.service
[Service]
WorkingDirectory=/srv/moth
User=www-data
ExecStart=/srv/moth/mothd
KillMode=process
Restart=on-failure
[Install]
WantedBy=multi-user.target