First commit

This commit is contained in:
yo
2023-08-19 18:00:41 +02:00
commit 4492d02b10
5 changed files with 91 additions and 0 deletions

58
files/glapi.in Normal file
View File

@ -0,0 +1,58 @@
#!/bin/sh
# PROVIDE: glapi
# REQUIRE: LOGIN
# KEYWORD: shutdown
#
# Add the following lines to /etc/rc.conf.local or /etc/rc.conf
# to enable this service:
#
# glapi_enable (bool): Set to NO by default.
# Set it to YES to enable glapi.
# glapi_user (string): Set user that glapi will run under
# Default is "nobody".
# glapi_group (string): Set group that glapi will run under
# Default is "nobody".
# glapi_args (string): Set extra arguments to pass to glapi
# Default is "".
# glapi_config (string): Set glapi configuration file
# Default is "/usr/local/etc/glapi.env".
# glapi_listen_address (string):Set ip:port that glapi will listen on
# Default is ":8080".
. /etc/rc.subr
name=glapi
rcvar=glapi_enable
load_rc_config $name
: ${glapi_enable:="NO"}
: ${glapi_user:="nobody"}
: ${glapi_group:="nobody"}
: ${glapi_args:=""}
: ${glapi_config:="/usr/local/etc/glapi.env"}
: ${glapi_listen_address:=":8080"}
: ${glapi_restart_delay:=3}
pidfile=/var/run/glapi.pid
command="/usr/sbin/daemon"
glapi_command="%%PREFIX%%/bin/glapi"
command_args="-rP ${pidfile} -S -R ${glapi_restart_delay} \
-T ${name} ${glapi_command} \
-config ${glapi_config} \
-listen-addr ${glapi_listen_address} \
${glapi_args}"
required_files="${glapi_config}"
start_precmd=glapi_startprecmd
glapi_startprecmd()
{
if [ ! -e ${pidfile} ]; then
install -o ${glapi_user} -g ${glapi_group} /dev/null ${pidfile};
fi
}
load_rc_config $name
run_rc_command "$1"