openrc servicing

This commit is contained in:
anon 2023-12-17 12:49:56 +01:00
parent 79230e7a88
commit 695eec653c
2 changed files with 24 additions and 0 deletions

View File

@ -11,6 +11,7 @@ endif
LDLIBS := -lircclient
INSTALL_TARGET := /etc/init.d/hibot
OUT := hibot
SOURCE.d := source/
@ -28,5 +29,9 @@ run: ${OUT}
test: ${OUT}
${WRAP} ${OUT} irc.rizon.net:6665 "#/g/test"
install:
m4 script/hibot.m4 > ${INSTALL_TARGET}
clean:
-rm ${OUT}
-rm ${INSTALL_TARGET}

19
script/hibot.m4 Normal file
View File

@ -0,0 +1,19 @@
#!/sbin/openrc-run
command_args="irc.rizon.net:6665 #/g/test"
name="hibot"
command="syscmd(`printf $(pwd)')/${name}"
pidfile="/var/run/${name}.pid"
start() {
ebegin "Starting $name"
start-stop-daemon --start --background --make-pidfile --pidfile "$pidfile" --exec "$command" -- $command_args
eend $?
}
stop() {
ebegin "Stopping $name"
start-stop-daemon --stop --pidfile "$pidfile"
eend $?
}