Add OpenRC script
This commit is contained in:
parent
520097460b
commit
4dde8d94cb
1 changed files with 29 additions and 0 deletions
29
contrib/openrc/init.d/tomservobot
Normal file
29
contrib/openrc/init.d/tomservobot
Normal file
|
@ -0,0 +1,29 @@
|
|||
#!/sbin/openrc-run
|
||||
supervisor=supervise-daemon
|
||||
|
||||
name="tomservobot"
|
||||
description="A custom bot for the local Matrix instance"
|
||||
|
||||
pidfile="/var/run/$name.pid"
|
||||
user="tomservo"
|
||||
script_args="./main.py"
|
||||
script_exec="/srv/tomservobot/.venv/bin/python"
|
||||
workdir="/srv/tomservobot/src"
|
||||
|
||||
depend() {
|
||||
need net synapse
|
||||
}
|
||||
|
||||
start() {
|
||||
ebegin "Starting Tom Servo Bot"
|
||||
cd $workdir || exit 1
|
||||
|
||||
start-stop-daemon --start --user "$user" --make-pidfile --pidfile "$pidfile" --chdir "$workdir" --exec "$script_exec" -- $script_args >> /var/log/tomservobot/bot.log 2>&1 &
|
||||
eend $?
|
||||
}
|
||||
|
||||
stop() {
|
||||
ebegin "Stopping Tom Servo Bot"
|
||||
start-stop-daemon --stop --pidfile "$pidfile"
|
||||
eend $?
|
||||
}
|
Loading…
Reference in a new issue