Index: head/net-mgmt/smokeping/Makefile =================================================================== --- head/net-mgmt/smokeping/Makefile (revision 390933) +++ head/net-mgmt/smokeping/Makefile (revision 390934) @@ -1,113 +1,113 @@ # Created by: Lars Thegler # $FreeBSD$ 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/ MAINTAINER= rodrigo@FreeBSD.org COMMENT= Latency logging and graphing system LICENSE= GPLv2 LIB_DEPENDS= librrd.so:${PORTSDIR}/databases/rrdtool BUILD_DEPENDS= p5-CGI-Session>=0:${PORTSDIR}/www/p5-CGI-Session \ p5-Digest-HMAC>=0:${PORTSDIR}/security/p5-Digest-HMAC \ p5-Net-SNMP>=0:${PORTSDIR}/net-mgmt/p5-Net-SNMP \ p5-Net-DNS>=0:${PORTSDIR}/dns/p5-Net-DNS \ p5-IO-Pty-Easy>=0:${PORTSDIR}/devel/p5-IO-Pty-Easy \ p5-SNMP_Session>=0:${PORTSDIR}/net-mgmt/p5-SNMP_Session \ p5-libwww>=0:${PORTSDIR}/www/p5-libwww \ p5-CGI>=0:${PORTSDIR}/www/p5-CGI \ p5-FCGI>=0:${PORTSDIR}/www/p5-FCGI \ p5-Config-Grammar>=0:${PORTSDIR}/devel/p5-Config-Grammar \ p5-Socket6>=0:${PORTSDIR}/net/p5-Socket6 \ p5-IO-Socket-SSL>=0:${PORTSDIR}/security/p5-IO-Socket-SSL \ p5-Net-Telnet>=0:${PORTSDIR}/net/p5-Net-Telnet \ p5-Net-OpenSSH>=0:${PORTSDIR}/net/p5-Net-OpenSSH \ p5-perl-ldap>=0:${PORTSDIR}/net/p5-perl-ldap RUN_DEPENDS:= ${BUILD_DEPENDS} USES= gmake perl5 GNU_CONFIGURE= yes CONFIGURE_ENV+= PERL=${PERL} PERL5LIB=${PREFIX}/smokeping/lib CONFIGURE_ARGS+= \ --sysconfdir=${ETCDIR} \ --localstatedir="${PREFIX}/var" \ --with-htdocs-dir=${PREFIX}/smokeping/htdocs \ --libdir=${PREFIX}/smokeping/lib HTDOCSDIR= ${PREFIX}/smokeping/htdocs USE_RC_SUBR= smokeping PKGDEINSTALL= ${WRKDIR}/pkg-deinstall USERS= smokeping GROUPS= smokeping SUB_FILES= pkg-deinstall pkg-message SUB_LIST= USERS=${USERS} \ GROUPS=${GROUPS} FPING_DESC= Support for fping probes ECHOPING_DESC= Support for EchoPing probes CURL_DESC= Support for Curl probes RADIUS_DESC= Support for Radius probes TELNET_DESC= Support for TelnetIOSPing probes DNS_DESC= Support for AnotherDNS probes OPTIONS_DEFINE= ECHOPING CURL RADIUS TELNET DNS FPING OPTIONS_DEFAULT= FPING .include .if ${PORT_OPTIONS:MFPING} RUN_DEPENDS+= ${LOCALBASE}/sbin/fping:${PORTSDIR}/net/fping .endif .if ${PORT_OPTIONS:MECHOPING} RUN_DEPENDS+= ${LOCALBASE}/bin/echoping:${PORTSDIR}/net/echoping .endif .if ${PORT_OPTIONS:MCURL} RUN_DEPENDS+= ${LOCALBASE}/bin/curl:${PORTSDIR}/ftp/curl .endif .if ${PORT_OPTIONS:MRADIUS} RUN_DEPENDS+= p5-Authen-Radius>=0:${PORTSDIR}/security/p5-Authen-Radius .endif .if ${PORT_OPTIONS:MTELNET} RUN_DEPENDS+= p5-Net-Telnet>=0:${PORTSDIR}/net/p5-Net-Telnet .endif .if ${PORT_OPTIONS:MDNS} RUN_DEPENDS+= p5-Net-DNS>=0:${PORTSDIR}/dns/p5-Net-DNS .endif .include .if ${PERL_LEVEL} >= 502100 BUILD_DEPENDS+= p5-CGI-Fast>=0:${PORTSDIR}/www/p5-CGI-Fast RUN_DEPENDS+= p5-CGI-Fast>=0:${PORTSDIR}/www/p5-CGI-Fast .endif # We will take these from CPAN instead post-extract: cd ${WRKSRC}/lib ; ${RM} BER.pm SNMP_util.pm SNMP_Session.pm post-patch: ${REINPLACE_CMD} ${SUB_LIST:S/$/!g/:S/^/ -e s!%%/:S/=/%%!/} \ ${WRKSRC}/doc/Makefile.in \ ${WRKSRC}/bin/smokeping \ ${WRKSRC}/bin/smokeping_cgi \ ${WRKSRC}/bin/tSmoke post-install: ${MKDIR} ${STAGEDIR}/${PREFIX}/smokeping/htdocs/img ${MKDIR} ${STAGEDIR}/${PREFIX}/var/smokeping .include Index: head/net-mgmt/smokeping/files/smokeping.in =================================================================== --- head/net-mgmt/smokeping/files/smokeping.in (revision 390933) +++ head/net-mgmt/smokeping/files/smokeping.in (revision 390934) @@ -1,85 +1,112 @@ #!/bin/sh # Created by: Sean McAfee # $FreeBSD$ # PROVIDE: smokeping # REQUIRE: LOGIN # KEYWORD: shutdown # Define these smokeping_* variables in one of these files: # /etc/rc.conf # /etc/rc.conf.local # /etc/rc.conf.d/smokeping # # DO NOT CHANGE THESE DEFAULT VALUES HERE # # smokeping_flags="" . /etc/rc.subr name=smokeping rcvar=smokeping_enable extra_commands="status configtest reload" +start_cmd="smokeping_start" status_cmd="smokeping_status" configtest_cmd="smokeping_configtest" reload_cmd="smokeping_reload" stop_cmd="smokeping_stop" : ${smokeping_enable:=NO} # pidfile is hardcoded in Smokeping.pm, not configurable smokeping_pidfile="%%PREFIX%%/var/smokeping/pid" : ${smokeping_logfile=/var/log/smokeping.log} : ${smokeping_user="%%USERS%%"} : ${smokeping_group="%%GROUPS%%"} command="%%PREFIX%%/bin/smokeping" command_args="--logfile=${smokeping_logfile}" 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 run_rc_command "$1"