Date: Mon, 29 Jun 2015 19:39:24 +0000 (UTC) From: Rodrigo Osorio <rodrigo@FreeBSD.org> To: ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org Subject: svn commit: r390934 - in head/net-mgmt/smokeping: . files Message-ID: <201506291939.t5TJdOY1020429@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: rodrigo Date: Mon Jun 29 19:39:24 2015 New Revision: 390934 URL: https://svnweb.freebsd.org/changeset/ports/390934 Log: Fix init script to check pid correctly PR: 200851 Submitted by: Kan Sasaki <sasaki@fcc.ad.jp> Modified: head/net-mgmt/smokeping/Makefile head/net-mgmt/smokeping/files/smokeping.in Modified: head/net-mgmt/smokeping/Makefile ============================================================================== --- head/net-mgmt/smokeping/Makefile Mon Jun 29 19:13:05 2015 (r390933) +++ head/net-mgmt/smokeping/Makefile Mon Jun 29 19:39:24 2015 (r390934) @@ -3,7 +3,7 @@ PORTNAME= smokeping PORTVERSION= 2.6.11 -PORTREVISION= 2 +PORTREVISION= 3 CATEGORIES= net-mgmt www MASTER_SITES= http://oss.oetiker.ch/smokeping/pub/ \ http://smokeping.cs.pu.edu.tw/pub/ Modified: head/net-mgmt/smokeping/files/smokeping.in ============================================================================== --- head/net-mgmt/smokeping/files/smokeping.in Mon Jun 29 19:13:05 2015 (r390933) +++ head/net-mgmt/smokeping/files/smokeping.in Mon Jun 29 19:39:24 2015 (r390934) @@ -24,6 +24,7 @@ rcvar=smokeping_enable extra_commands="status configtest reload" +start_cmd="smokeping_start" status_cmd="smokeping_status" configtest_cmd="smokeping_configtest" reload_cmd="smokeping_reload" @@ -41,43 +42,69 @@ command_args="--logfile=${smokeping_logf pidfile="${smokeping_pidfile}" command_interpreter="%%PREFIX%%/bin/perl" -smokeping_startprecmd() +smokeping_check_pidfile() { + rc_pid=$(check_pidfile $pidfile $command) + if [ -z "${rc_pid}" ]; then + rc_pid=$(check_pidfile $pidfile $command $command_interpreter) + fi +} + +smokeping_start() +{ + smokeping_check_pidfile + if [ -n "$rc_pid" ]; then + echo 1>&2 "${name} already running? (pid=$rc_pid)." + return 1 + fi + if [ ! -e ${smokeping_logfile} ]; then - install -o %%USERS%% -g %%GROUPS%% /dev/null ${smokeping_logfile} || echo "ERROR: Could not initialize logfile at ${smokeping_logfile}."; + install -o ${smokeping_user} -g ${smokeping_group} -m 644 /dev/null ${smokeping_logfile} ||\ + echo "ERROR: Could not initialize logfile at ${smokeping_logfile}."; fi + + echo "Starting ${name}." + ${command} ${smokeping_flags} ${command_args} } smokeping_status() { - rc_pid=$(check_pidfile $pidfile $command $command_interpreter) + smokeping_check_pidfile if [ -z "$rc_pid" ]; then - _run_rc_notrunning + echo "${name} is not running." + return 1 else echo "${name} is running as pid $rc_pid" - fi + fi } smokeping_configtest() { - /usr/local/bin/smokeping --check + ${command} --check } smokeping_reload() { - /usr/local/bin/smokeping --reload + smokeping_check_pidfile + if [ -z "$rc_pid" ]; then + _run_rc_notrunning + return 1 + else + ${command} --reload + fi } smokeping_stop() { - rc_pid=$(check_pidfile $pidfile $command $command_interpreter) + smokeping_check_pidfile if [ -z "$rc_pid" ]; then _run_rc_notrunning + return 1 else - echo "Stopping ${name} (pid $rc_pid)." - kill -15 $rc_pid - fi + echo "Stopping ${name}." + kill -TERM $rc_pid + fi } load_rc_config $name
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201506291939.t5TJdOY1020429>