commit 9413b45124dc947c6c1437fb5aa6e144cd075366 (patch) parent 1e932b48215a8f45c96877a6b7a77541fe43236b Author: Alex Karle <alex@alexkarle.com> Date: Sat, 18 Jul 2020 15:01:55 -0400 bin: Add first take at OpenBSD rc.d init script I'm not convinced using shell redirects / backgrounding (&) is the proper way to daemonize this process / capture logs. Ideally the webserver would be able to do both itself. However, as a checkpoint, this is a functional rc.d script to start/stop/check the server. Diffstat:
A | bin/euchre-service.sh | | | 17 | +++++++++++++++++ |
1 file changed, 17 insertions(+), 0 deletions(-)
diff --git a/bin/euchre-service.sh b/bin/euchre-service.sh @@ -0,0 +1,17 @@ +#!/bin/ksh +# OpenBSD rc.d service for euchre.live + +# config +INSTALL="/home/_euchre/prod-el" +# end config + +daemon="$INSTALL/gloat.pl daemon -m production" +daemon_flags=">> /var/log/gloat/prod.log 2>&1 &" +daemon_user="_euchre" + +. /etc/rc.d/rc.subr + +# use pexp because the redirections in the flags won't show up in pgrep +pexp="perl $daemon" + +rc_cmd "$1"