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/cbsdd.in | |
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/cbsdd.in')
-rw-r--r-- | sysutils/cbsd/files/cbsdd.in | 33 |
1 files changed, 23 insertions, 10 deletions
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 |