diff options
author | Roman Bogorodskiy <novel@FreeBSD.org> | 2018-11-26 05:52:55 +0000 |
---|---|---|
committer | Roman Bogorodskiy <novel@FreeBSD.org> | 2018-11-26 05:52:55 +0000 |
commit | 60ba5d1af81d11802ba91647b5d192e496a41a38 (patch) | |
tree | a58b42b54d8254de2fdaca39e21078776e5c95f3 /sysutils/cbsd/files | |
parent | www/py-libsass: Update 0.16.0 -> 0.16.1 (diff) |
sysutils/cbsd: update to 12.0.2
PR: 233476
Submitted by: maintainer
Notes
Notes:
svn path=/head/; revision=485917
Diffstat (limited to 'sysutils/cbsd/files')
-rw-r--r-- | sysutils/cbsd/files/cbsd-statsd-bhyve.in | 96 | ||||
-rw-r--r-- | sysutils/cbsd/files/cbsd-statsd-hoster.in | 96 | ||||
-rw-r--r-- | sysutils/cbsd/files/cbsd-statsd-jail.in | 96 | ||||
-rw-r--r-- | sysutils/cbsd/files/cbsdd.in | 33 |
4 files changed, 311 insertions, 10 deletions
diff --git a/sysutils/cbsd/files/cbsd-statsd-bhyve.in b/sysutils/cbsd/files/cbsd-statsd-bhyve.in new file mode 100644 index 000000000000..3da82bc1fc4b --- /dev/null +++ b/sysutils/cbsd/files/cbsd-statsd-bhyve.in @@ -0,0 +1,96 @@ +#!/bin/sh +# +# PROVIDE: cbsd_statsd_bhyve +# REQUIRE: LOGIN FILESYSTEMS sshd +# KEYWORD: shutdown +# +# cbsd_statsd_bhyve_enable="YES" +# + +. /etc/rc.subr + +name=cbsd_statsd_bhyve +rcvar=cbsd_statsd_bhyve_enable +load_rc_config $name + +# Set defaults +: ${cbsd_statsd_bhyve_enable:="NO"} + +export workdir="${cbsd_workdir}" +globalconf=${cbsd_globalconf:-"${workdir}/cbsd.conf"} + +start_cmd=${name}_start +restart_cmd=${name}_restart +extra_commands="restart" + +command="${cbsd_workdir}/tools/racct-bhyve-statsd" +pidfile="/var/run/$name.pid" +command_args="&" + +pidfile=/var/run/racct-bhyve-statsd.pid + +if [ ! -f ${globalconf} ]; then + echo "cbsd: no such ${globalconf}"; + exit 1 +fi + +if [ ! -f ${subr} ]; then + echo "cbsd: no such ${subr}"; + exit 1 +fi + +. ${globalconf} +. ${subr} + +cbsd_statsd_bhyve_start() +{ + local args= racct_enabled= + + # RACCT enabled? + racct_enabled=$( /sbin/sysctl -qn kern.racct.enable ) + [ $? -ne 0 ] && err 1 "cbsd-statsd-bhyve: RACCT not enabled" + [ "${racct_enabled}" != "1" ] && err 1 "cbsd-statsd-bhyve: RACCT not enabled" + + readconf racct-bhyve-statsd.conf + [ -n "${log_file}" ] && args="${args} --log_file=${log_file}" + [ -n "${log_level}" ] && args="${args} --log_level=${log_level}" + [ -n "${loop_interval}" ] && args="${args} --loop_interval=${loop_interval}" + [ -n "${save_loop_count}" ] && args="${args} --save_loop_count=${save_loop_count}" + + case "${prometheus_exporter_enable}" in + [Yy][Ee][Ss]) + args="${args} --prometheus_exporter=1" + ;; + [No][Oo]) + args="${args} --prometheus_exporter=0" + ;; + esac + + case "${beanstald_enable}" in + [Yy][Ee][Ss]) + args="${args} --save_beanstalkd=1" + ;; + [No][Oo]) + args="${args} --save_beanstalkd=0" + ;; + esac + + case "${sqlite3_enable}" in + [Yy][Ee][Ss]) + args="${args} --save_sqlite=1" + ;; + [No][Oo]) + args="${args} --save_sqlite=0" + ;; + esac + + exec env workdir=${cbsd_workdir} ${cbsd_workdir}/tools/racct-bhyve-statsd ${args} +} + +cbsd_statsd_bhyve_restart() +{ + cbsd_statsd_bhyve_stop + cbsd_statsd_bhyve_start +} + +run_rc_command "$1" diff --git a/sysutils/cbsd/files/cbsd-statsd-hoster.in b/sysutils/cbsd/files/cbsd-statsd-hoster.in new file mode 100644 index 000000000000..28aacfd16334 --- /dev/null +++ b/sysutils/cbsd/files/cbsd-statsd-hoster.in @@ -0,0 +1,96 @@ +#!/bin/sh +# +# PROVIDE: cbsd_statsd_hoster +# REQUIRE: LOGIN FILESYSTEMS sshd +# KEYWORD: shutdown +# +# cbsd_statsd_hoster_enable="YES" +# + +. /etc/rc.subr + +name=cbsd_statsd_hoster +rcvar=cbsd_statsd_hoster_enable +load_rc_config $name + +# Set defaults +: ${cbsd_statsd_hoster_enable:="NO"} + +export workdir="${cbsd_workdir}" +globalconf=${cbsd_globalconf:-"${workdir}/cbsd.conf"} + +start_cmd=${name}_start +restart_cmd=${name}_restart +extra_commands="restart" + +command="${cbsd_workdir}/tools/racct-hoster-statsd" +pidfile="/var/run/$name.pid" +command_args="&" + +pidfile=/var/run/racct-hoster-statsd.pid + +if [ ! -f ${globalconf} ]; then + echo "cbsd: no such ${globalconf}"; + exit 1 +fi + +if [ ! -f ${subr} ]; then + echo "cbsd: no such ${subr}"; + exit 1 +fi + +. ${globalconf} +. ${subr} + +cbsd_statsd_hoster_start() +{ + local args= racct_enabled= + + # RACCT enabled? + racct_enabled=$( /sbin/sysctl -qn kern.racct.enable ) + [ $? -ne 0 ] && err 1 "cbsd-statsd-hoster: RACCT not enabled" + [ "${racct_enabled}" != "1" ] && err 1 "cbsd-statsd-hoster: RACCT not enabled" + + readconf racct-hoster-statsd.conf + [ -n "${log_file}" ] && args="${args} --log_file=${log_file}" + [ -n "${log_level}" ] && args="${args} --log_level=${log_level}" + [ -n "${loop_interval}" ] && args="${args} --loop_interval=${loop_interval}" + [ -n "${save_loop_count}" ] && args="${args} --save_loop_count=${save_loop_count}" + + case "${prometheus_exporter_enable}" in + [Yy][Ee][Ss]) + args="${args} --prometheus_exporter=1" + ;; + [No][Oo]) + args="${args} --prometheus_exporter=0" + ;; + esac + + case "${beanstald_enable}" in + [Yy][Ee][Ss]) + args="${args} --save_beanstalkd=1" + ;; + [No][Oo]) + args="${args} --save_beanstalkd=0" + ;; + esac + + case "${sqlite3_enable}" in + [Yy][Ee][Ss]) + args="${args} --save_sqlite=1" + ;; + [No][Oo]) + args="${args} --save_sqlite=0" + ;; + esac + + exec env workdir=${cbsd_workdir} ${cbsd_workdir}/tools/racct-hoster-statsd ${args} +} + +cbsd_statsd_hoster_restart() +{ + cbsd_statsd_hoster_stop + cbsd_statsd_hoster_start +} + +run_rc_command "$1" diff --git a/sysutils/cbsd/files/cbsd-statsd-jail.in b/sysutils/cbsd/files/cbsd-statsd-jail.in new file mode 100644 index 000000000000..fda4ffbbe273 --- /dev/null +++ b/sysutils/cbsd/files/cbsd-statsd-jail.in @@ -0,0 +1,96 @@ +#!/bin/sh +# +# PROVIDE: cbsd_statsd_jail +# REQUIRE: LOGIN FILESYSTEMS sshd +# KEYWORD: shutdown +# +# cbsd_statsd_jail_enable="YES" +# + +. /etc/rc.subr + +name=cbsd_statsd_jail +rcvar=cbsd_statsd_jail_enable +load_rc_config $name + +# Set defaults +: ${cbsd_statsd_jail_enable:="NO"} + +export workdir="${cbsd_workdir}" +globalconf=${cbsd_globalconf:-"${workdir}/cbsd.conf"} + +start_cmd=${name}_start +restart_cmd=${name}_restart +extra_commands="restart" + +command="${cbsd_workdir}/tools/racct-jail-statsd" +pidfile="/var/run/$name.pid" +command_args="&" + +pidfile=/var/run/racct-jail-statsd.pid + +if [ ! -f ${globalconf} ]; then + echo "cbsd: no such ${globalconf}"; + exit 1 +fi + +if [ ! -f ${subr} ]; then + echo "cbsd: no such ${subr}"; + exit 1 +fi + +. ${globalconf} +. ${subr} + +cbsd_statsd_jail_start() +{ + local args= racct_enabled= + + # RACCT enabled? + racct_enabled=$( /sbin/sysctl -qn kern.racct.enable ) + [ $? -ne 0 ] && err 1 "cbsd-statsd-jail: RACCT not enabled" + [ "${racct_enabled}" != "1" ] && err 1 "cbsd-statsd-jail: RACCT not enabled" + + readconf racct-jail-statsd.conf + [ -n "${log_file}" ] && args="${args} --log_file=${log_file}" + [ -n "${log_level}" ] && args="${args} --log_level=${log_level}" + [ -n "${loop_interval}" ] && args="${args} --loop_interval=${loop_interval}" + [ -n "${save_loop_count}" ] && args="${args} --save_loop_count=${save_loop_count}" + + case "${prometheus_exporter_enable}" in + [Yy][Ee][Ss]) + args="${args} --prometheus_exporter=1" + ;; + [No][Oo]) + args="${args} --prometheus_exporter=0" + ;; + esac + + case "${beanstald_enable}" in + [Yy][Ee][Ss]) + args="${args} --save_beanstalkd=1" + ;; + [No][Oo]) + args="${args} --save_beanstalkd=0" + ;; + esac + + case "${sqlite3_enable}" in + [Yy][Ee][Ss]) + args="${args} --save_sqlite=1" + ;; + [No][Oo]) + args="${args} --save_sqlite=0" + ;; + esac + + exec env workdir=${cbsd_workdir} ${cbsd_workdir}/tools/racct-jail-statsd ${args} +} + +cbsd_statsd_jail_restart() +{ + cbsd_statsd_jail_stop + cbsd_statsd_jail_start +} + +run_rc_command "$1" diff --git a/sysutils/cbsd/files/cbsdd.in b/sysutils/cbsd/files/cbsdd.in index 75c715a0132b..d0be0dfcc875 100644 --- a/sysutils/cbsd/files/cbsdd.in +++ b/sysutils/cbsd/files/cbsdd.in @@ -49,8 +49,8 @@ start_precmd=${name}_prestart stop_precmd=${name}_prestop stop_cmd=${name}_stop status_cmd="${name}_status" -reload_cmd=${name}_reload -extra_commands="reload" +restart_cmd=${name}_restart +extra_commands="restart" command="${toolsdir}/cbsdd" pidfile="/var/run/$name.pid" @@ -58,7 +58,6 @@ command_args="&" cbsdd_prestart() { %%PREFIX%%/bin/cbsd task mode=flushall > /dev/null 2>&1 - . ${distdir}/initenv.subr . ${inventory} @@ -67,7 +66,7 @@ cbsdd_prestart() { update_netinfo env sqlcolnames="1" ${miscdir}/sqlcli ${dbdir}/local.sqlite "SELECT * FROM local" > ${inventory} ${miscdir}/sqlcli ${dbdir}/local.sqlite "UPDATE jails SET status='0' WHERE status='3'" - [ -n "$nat_enable" ] && %%PREFIX%%/bin/cbsd naton + [ -n "${nat_enable}" ] && %%PREFIX%%/bin/cbsd naton /usr/sbin/daemon -f ${rcddir}/jails-astart start } @@ -80,15 +79,21 @@ cbsdd_prestop() cbsdd_stop() { if [ -f "${pidfile}" ]; then - kill -9 $( /bin/cat ${pidfile} ) - /bin/rm -f ${pidfile} + pids=$( pgrep -F ${pidfile} 2>&1 ) + _err=$? + if [ ${_err} -eq 0 ]; then + kill -9 ${pids} && /bin/rm -f ${pidfile} + else + echo "pgrep: ${pids}" + return ${_err} + fi fi } -cbsdd_reload() +cbsdd_restart() { if [ -f "${pidfile}" ]; then - kill -9 $( /bin/cat ${pidfile} ) > /dev/null 2>&1 + pkill -9 -f ${pidfile} > /dev/null 2>&1 /bin/rm -f ${pidfile} fi run_rc_command "start" @@ -97,9 +102,17 @@ cbsdd_reload() cbsdd_status() { + local _err + if [ -f "${pidfile}" ]; then - pids=$( /bin/cat ${pidfile} ) - echo "${name} is running as pid ${pids}." + pids=$( pgrep -F ${pidfile} 2>&1 ) + _err=$? + if [ ${_err} -eq 0 ]; then + echo "${name} is running as pid ${pids}." + else + echo "pgrep: ${pids}" + return ${_err} + fi else echo "${name} is not running." return 1 |