aboutsummaryrefslogtreecommitdiff
path: root/shroom_daemon.sh
blob: adf6712fdc4615eaa5d8bdbd67ffa847f0a154e6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
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 $?
}