Bug 184747

Summary: sysutils/ganglia-monitor-core: gmond script does not start at boot time
Product: Ports & Packages Reporter: Ganael LAPLANCHE <martymac>
Component: Individual Port(s)Assignee: Ganael LAPLANCHE <martymac>
Status: Closed FIXED    
Severity: Affects Only Me    
Priority: Normal    
Version: Latest   
Hardware: Any   
OS: Any   
Attachments:
Description Flags
patch-ganglia-monitor-core.txt none

Description Ganael LAPLANCHE freebsd_committer freebsd_triage 2013-12-13 14:00:00 UTC
Hi Steven,

The following patch to gmond.in :

http://svnweb.freebsd.org/ports/head/sysutils/ganglia-monitor-core/files/gmond.in?r1=251553&r2=283939

introduced a bug in the script.

When started manually, everything runs fine, but when started during the boot sequence, gmond is never started.

This is because at boot time, $0 is set to /etc/rc, which leads to setting the 'name' variable to rc. As a consequence, the remaining of the script fails.
Comment 1 Ganael LAPLANCHE freebsd_committer freebsd_triage 2013-12-13 14:37:40 UTC
Responsible Changed
From-To: freebsd-bugs->skreuzer

Over to maintainer.
Comment 2 Ganael LAPLANCHE freebsd_committer freebsd_triage 2013-12-16 08:40:00 UTC
Here is a patch that should fix the issue. The idea is to get file name
from $_file instead of $0. This patch is inspired from openvpn startup
script :

http://svnweb.freebsd.org/ports/head/security/openvpn/files/openvpn.in?revision=302141&view=markup

Note that I have tested this patch with a single instance of gmond only.

Best regards,

--
Ganael LAPLANCHE <ganael.laplanche@martymac.org>
http://www.martymac.org | http://contribs.martymac.org
FreeBSD: martymac <martymac@FreeBSD.org>, http://www.FreeBSD.org
Comment 3 dfilter service freebsd_committer freebsd_triage 2014-01-07 08:04:17 UTC
Author: martymac
Date: Tue Jan  7 08:04:09 2014
New Revision: 338980
URL: http://svnweb.freebsd.org/changeset/ports/338980

Log:
  Fix gmond startup at boot time
  
  PR:		ports/184747
  Submitted by:	martymac
  Approved by:	skreuzer (maintainer)

Modified:
  head/sysutils/ganglia-monitor-core/Makefile   (contents, props changed)
  head/sysutils/ganglia-monitor-core/files/gmond.in   (contents, props changed)

Modified: head/sysutils/ganglia-monitor-core/Makefile
==============================================================================
--- head/sysutils/ganglia-monitor-core/Makefile	Tue Jan  7 07:35:09 2014	(r338979)
+++ head/sysutils/ganglia-monitor-core/Makefile	Tue Jan  7 08:04:09 2014	(r338980)
@@ -2,7 +2,7 @@
 
 PORTNAME=	monitor-core
 PORTVERSION=	3.4.0
-PORTREVISION=	1
+PORTREVISION=	2
 CATEGORIES=	sysutils net parallel
 MASTER_SITES=	SF/ganglia/ganglia%20monitoring%20core/${PORTVERSION}
 PKGNAMEPREFIX=	ganglia-

Modified: head/sysutils/ganglia-monitor-core/files/gmond.in
==============================================================================
--- head/sysutils/ganglia-monitor-core/files/gmond.in	Tue Jan  7 07:35:09 2014	(r338979)
+++ head/sysutils/ganglia-monitor-core/files/gmond.in	Tue Jan  7 08:04:09 2014	(r338980)
@@ -1,14 +1,23 @@
 #!/bin/sh
-# $FreeBSD: head/sysutils/ganglia-monitor-core/files/gmond.in 302141 2012-08-05 23:19:36Z dougb $
+# $FreeBSD$
 
 # PROVIDE: gmond
 # REQUIRE: DAEMON
 # KEYWORD: shutdown
 
-bname=`basename $0`
-
 . /etc/rc.subr
 
+case "$0" in
+/etc/rc*)
+	# during boot (shutdown) $0 is /etc/rc (/etc/rc.shutdown),
+	# so get the name of the script from $_file
+	bname=`basename $_file`
+	;;
+*)
+	bname=`basename $0`
+	;;
+esac
+
 name=`echo "${bname}" | tr ".-" "__"`
 rcvar=${name}_enable
 
_______________________________________________
svn-ports-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-ports-all
To unsubscribe, send any mail to "svn-ports-all-unsubscribe@freebsd.org"
Comment 4 Ganael LAPLANCHE freebsd_committer freebsd_triage 2014-01-07 08:06:09 UTC
Responsible Changed
From-To: skreuzer->martymac

I will take care of it.
Comment 5 Ganael LAPLANCHE freebsd_committer freebsd_triage 2014-01-07 08:06:26 UTC
State Changed
From-To: open->closed

Committed, thanks!