aboutsummaryrefslogtreecommitdiff
path: root/shroom_daemon
diff options
context:
space:
mode:
authorerg <uinarf@autistici.org>2023-02-28 10:12:46 +0100
committererg <uinarf@autistici.org>2023-02-28 10:12:46 +0100
commitad96edf8be0e758277f77c521ebb0e8383cda647 (patch)
tree1b265f4424c6e725bebdb1aeb811d75eeb43bf2a /shroom_daemon
downloadPi_Relay-ad96edf8be0e758277f77c521ebb0e8383cda647.tar.gz
Pi_Relay-ad96edf8be0e758277f77c521ebb0e8383cda647.tar.bz2
Pi_Relay-ad96edf8be0e758277f77c521ebb0e8383cda647.zip
Initial commit
Diffstat (limited to 'shroom_daemon')
-rw-r--r--shroom_daemon29
1 files changed, 29 insertions, 0 deletions
diff --git a/shroom_daemon b/shroom_daemon
new file mode 100644
index 0000000..708589c
--- /dev/null
+++ b/shroom_daemon
@@ -0,0 +1,29 @@
+#!/sbin/openrc-run
+# Copyright 2023 erg_samowzbudnik
+# Distributed under the terms of the GNU General Public Licence v2
+
+# Set username you want process run with. Should be your regular user
+USERNAME="pipi"
+GROUP=$(id -g ${USERNAME})
+supervisor="supervise-daemon"
+command_args_foreground="--foreground"
+# Could also get dir to store pid file from XDG_RUNTIME_DIR
+pidfile="/run/${RC_SVCNAME}.pid"
+# pidfile="/run/user/${GROUP}/${RC_SVCNAME}.pid"
+extra_started_commands="reload"
+command_user="${USERNAME}:${USERNAME}"
+# command_user="${USER}:${GROUP}"
+command="python /usr/local/sbin/pi_relay.py"
+description="Daemon for shroombox"
+
+depend() {
+ need localmount
+ use logger
+}
+
+reload() {
+ ebegin "Reloading ${RC_SVCNAME}configuration"
+ start-stop-daemon --exec "$command" --signal HUP
+ ${supervisor} "${RC_SVCNAME}" --signal HUP --pidfile "${pidfile}"
+ eend $?
+}