aboutsummaryrefslogtreecommitdiff
path: root/shroom_daemon.sh
diff options
context:
space:
mode:
authorerg <uinarf@autistici.org>2023-01-12 16:15:35 +0100
committererg <uinarf@autistici.org>2023-01-12 16:15:35 +0100
commitd6970e81e607f27bee9323d10d1476621de3416c (patch)
tree1c27d765440256468eb24ecafef78a17cbdf72db /shroom_daemon.sh
downloadPi_Temp_PID_Control-d6970e81e607f27bee9323d10d1476621de3416c.tar.gz
Pi_Temp_PID_Control-d6970e81e607f27bee9323d10d1476621de3416c.tar.bz2
Pi_Temp_PID_Control-d6970e81e607f27bee9323d10d1476621de3416c.zip
Initial commit
Diffstat (limited to 'shroom_daemon.sh')
-rw-r--r--shroom_daemon.sh25
1 files changed, 25 insertions, 0 deletions
diff --git a/shroom_daemon.sh b/shroom_daemon.sh
new file mode 100644
index 0000000..adf6712
--- /dev/null
+++ b/shroom_daemon.sh
@@ -0,0 +1,25 @@
+#!/sbin/openrc-run
+# Copyright 2023 erg_samowzbudnik
+# Distributed under the terms of the GNU General Public Licence v2
+
+GROUP=$(id -g)
+supervisor="supervise-daemon"
+command_args_foreground="--foreground"
+# Could also get dir to store pid file from XDG_RUNTIME_DIR
+pidfile="/run/user/${UID}/${RC_SVCNAME}.pid"
+extra_started_commands="reload"
+command_user="${USER}:${GROUP}"
+command="python main.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 $?
+}