FreeBSD rc files
This commit is contained in:
35
routerstats_client.rc
Executable file
35
routerstats_client.rc
Executable file
@ -0,0 +1,35 @@
|
||||
#!/bin/sh
|
||||
# PROVIDE: routerstats_client
|
||||
|
||||
# Configured by lines in /etc/rc.conf
|
||||
# routerstats_client_enable=BOOL (default: NO, set to YES to start
|
||||
# routerstats_client_flags=STR (default: "", set to "hostname port rrdfile"
|
||||
# routerstats_client_usr=STR (default: www, set to username to run under different user
|
||||
|
||||
. /etc/rc.subr
|
||||
|
||||
name="routerstats_client"
|
||||
rcvar=routerstats_client_enable
|
||||
|
||||
load_rc_config $name
|
||||
|
||||
: ${routerstats_client_enable:="NO"}
|
||||
: ${routerstats_client_usr:=www}
|
||||
: ${routerstats_client_flags=""}
|
||||
|
||||
#daemon
|
||||
basedir="/usr/local/www/routerstats"
|
||||
pidfile="${basedir}/${name}.pid"
|
||||
logfile="${basedir}/${name}.log"
|
||||
script_py="${basedir}/${name}.py"
|
||||
python="/usr/local/bin/python3"
|
||||
command="/usr/sbin/daemon"
|
||||
start_precmd="runfirst"
|
||||
|
||||
runfirst()
|
||||
{
|
||||
rc_flags=" -c -f -P ${pidfile} -u ${routerstats_client_usr} -o ${logfile} ${python} ${script_py} ${rc_flags}"
|
||||
install -o ${routerstats_client_usr} /dev/null ${pidfile}
|
||||
}
|
||||
|
||||
run_rc_command "$1"
|
||||
35
routerstats_httpd.rc
Executable file
35
routerstats_httpd.rc
Executable file
@ -0,0 +1,35 @@
|
||||
#!/bin/sh
|
||||
# PROVIDE: routerstats_httpd
|
||||
|
||||
# Configured by lines in /etc/rc.conf
|
||||
# routerstats_httpd_enable=BOOL (default: NO, set to YES to start
|
||||
# routerstats_httpd_flags=STR (default: "", set to the RRD-file you want to display data from
|
||||
# routerstats_httpd_usr=STR (default: www, set to username to run under different user
|
||||
|
||||
. /etc/rc.subr
|
||||
|
||||
name="routerstats_httpd"
|
||||
rcvar=routerstats_httpd_enable
|
||||
|
||||
load_rc_config $name
|
||||
|
||||
: ${routerstats_httpd_enable:="NO"}
|
||||
: ${routerstats_httpd_usr:=www}
|
||||
: ${routerstats_httpd_flags=""}
|
||||
|
||||
#daemon
|
||||
basedir="/usr/local/www/routerstats"
|
||||
pidfile="${basedir}/${name}.pid"
|
||||
logfile="${basedir}/${name}.log"
|
||||
script_py="${basedir}/${name}.py"
|
||||
python="/usr/local/bin/python3"
|
||||
command="/usr/sbin/daemon"
|
||||
start_precmd="runfirst"
|
||||
|
||||
runfirst()
|
||||
{
|
||||
rc_flags=" -c -f -P ${pidfile} -u ${routerstats_httpd_usr} -o ${logfile} ${python} ${script_py} ${rc_flags}"
|
||||
install -o ${routerstats_httpd_usr} /dev/null ${pidfile}
|
||||
}
|
||||
|
||||
run_rc_command "$1"
|
||||
Reference in New Issue
Block a user