public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] gentoo-x86 commit in net-analyzer/smokeping/files: smokeping.init.2
@ 2010-06-16 18:24 Peter Volkov (pva)
  0 siblings, 0 replies; 2+ messages in thread
From: Peter Volkov (pva) @ 2010-06-16 18:24 UTC (permalink / raw
  To: gentoo-commits

pva         10/06/16 18:24:17

  Added:                smokeping.init.2
  Log:
  Create /var/run/smokeping directory at init.d script start as FSH suggests. Fix permissions of that directory, bug #324177, thank Weeve for report.
  (Portage version: 2.1.8.3/cvs/Linux x86_64)

Revision  Changes    Path
1.1                  net-analyzer/smokeping/files/smokeping.init.2

file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/net-analyzer/smokeping/files/smokeping.init.2?rev=1.1&view=markup
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/net-analyzer/smokeping/files/smokeping.init.2?rev=1.1&content-type=text/plain

Index: smokeping.init.2
===================================================================
#!/sbin/runscript
# Copyright 1999-2008 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2

opts="${opts} dump reload restore"

depend() {
	need net
	use dns
}

checkconfig() {
	if [ ! -f "/etc/smokeping/config" ] ; then
		eerror "You need /etc/smokeping/config to run smokeping!"
		return 1
	fi
}

start() {
	checkconfig || return 1

	if [ ! -d /var/run/smokeping/ ]; then
		mkdir /var/run/smokeping/
	fi
	chown smokeping:smokeping /var/run/smokeping/

	ebegin "Starting smokeping"
	LC_ALL=C \
	start-stop-daemon --start --name smokeping \
		--pidfile /var/run/smokeping/smokeping.pid \
		--exec /usr/bin/smokeping \
		--chuid smokeping:smokeping
	eend $?
}

stop() {
	ebegin "Stopping smokeping"
	start-stop-daemon --stop \
		--pidfile /var/run/smokeping/smokeping.pid
	eend $?
}

reload() {
	ebegin "Reloading smokeping"
	/usr/bin/smokeping --reload 1>/dev/null 2>&1
	eend $?
}

dump() {
	ebegin "Dumping smokeping rrd files to XML for backup or upgrade use"
	if service_started "${myservice}" ; then
		eerror "You need to stop smokeping before dumping files!"
		return 1
	fi
	for f in `find /var/lib/smokeping -name '*.rrd' -print` ; do
		f_xml=`dirname $f`/`basename $f .rrd`.xml
		rrdtool dump "$f" > "${f_xml}"
		chown root:0 "${f_xml}"
	done
	eend $?
}

restore() {
	ebegin "Restoring smokeping rrd files from XML dump files"
	if service_started "${myservice}" ; then
		eerror "You need to stop smokeping before restoring files!"
		return 1
	fi
	for f in `find /var/lib/smokeping -name '*.xml' -print` ; do
		f_rrd=`dirname $f`/`basename $f .xml`.rrd
		mv -f "${f_rrd}" "${f_rrd}.bak"
		chown root:0 "${f_rrd}.bak"
		rrdtool restore "$f" "${f_rrd}"
		chown smokeping:smokeping "${f_rrd}"
	done
	eend $?
}






^ permalink raw reply	[flat|nested] 2+ messages in thread

* [gentoo-commits] gentoo-x86 commit in net-analyzer/smokeping/files: smokeping.init.2
@ 2012-04-29 10:32 Tobias Klausmann (klausman)
  0 siblings, 0 replies; 2+ messages in thread
From: Tobias Klausmann (klausman) @ 2012-04-29 10:32 UTC (permalink / raw
  To: gentoo-commits

klausman    12/04/29 10:32:15

  Modified:             smokeping.init.2
  Log:
  Fix init script to not trigger warnings with newer OpenRC. Also simplify dump and restore commands (OpenRC will do these checks for us now).
  
  (Portage version: 2.1.10.57/cvs/Linux x86_64)

Revision  Changes    Path
1.2                  net-analyzer/smokeping/files/smokeping.init.2

file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/net-analyzer/smokeping/files/smokeping.init.2?rev=1.2&view=markup
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/net-analyzer/smokeping/files/smokeping.init.2?rev=1.2&content-type=text/plain
diff : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/net-analyzer/smokeping/files/smokeping.init.2?r1=1.1&r2=1.2

Index: smokeping.init.2
===================================================================
RCS file: /var/cvsroot/gentoo-x86/net-analyzer/smokeping/files/smokeping.init.2,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- smokeping.init.2	16 Jun 2010 18:24:17 -0000	1.1
+++ smokeping.init.2	29 Apr 2012 10:32:15 -0000	1.2
@@ -1,8 +1,9 @@
 #!/sbin/runscript
-# Copyright 1999-2008 Gentoo Foundation
+# Copyright 1999-2012 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 
-opts="${opts} dump reload restore"
+extra_started_commands="reload"
+extra_stopped_commands="dump restore"
 
 depend() {
 	need net
@@ -48,10 +49,6 @@
 
 dump() {
 	ebegin "Dumping smokeping rrd files to XML for backup or upgrade use"
-	if service_started "${myservice}" ; then
-		eerror "You need to stop smokeping before dumping files!"
-		return 1
-	fi
 	for f in `find /var/lib/smokeping -name '*.rrd' -print` ; do
 		f_xml=`dirname $f`/`basename $f .rrd`.xml
 		rrdtool dump "$f" > "${f_xml}"
@@ -62,10 +59,6 @@
 
 restore() {
 	ebegin "Restoring smokeping rrd files from XML dump files"
-	if service_started "${myservice}" ; then
-		eerror "You need to stop smokeping before restoring files!"
-		return 1
-	fi
 	for f in `find /var/lib/smokeping -name '*.xml' -print` ; do
 		f_rrd=`dirname $f`/`basename $f .xml`.rrd
 		mv -f "${f_rrd}" "${f_rrd}.bak"






^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2012-04-29 10:32 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-04-29 10:32 [gentoo-commits] gentoo-x86 commit in net-analyzer/smokeping/files: smokeping.init.2 Tobias Klausmann (klausman)
  -- strict thread matches above, loose matches on Subject: below --
2010-06-16 18:24 Peter Volkov (pva)

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox