public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] gentoo-x86 commit in net-misc/tor/files: tor.initd-r7
@ 2014-09-23 23:14 Anthony G. Basile (blueness)
  0 siblings, 0 replies; 2+ messages in thread
From: Anthony G. Basile (blueness) @ 2014-09-23 23:14 UTC (permalink / raw
  To: gentoo-commits

blueness    14/09/23 23:14:00

  Added:                tor.initd-r7
  Log:
  Add graceful stop for testing, bug #523552
  
  (Portage version: 2.2.8-r1/cvs/Linux x86_64, signed Manifest commit with key 0xF52D4BBA)

Revision  Changes    Path
1.1                  net-misc/tor/files/tor.initd-r7

file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/net-misc/tor/files/tor.initd-r7?rev=1.1&view=markup
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/net-misc/tor/files/tor.initd-r7?rev=1.1&content-type=text/plain

Index: tor.initd-r7
===================================================================
#!/sbin/runscript
# Copyright 1999-2014 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/net-misc/tor/files/tor.initd-r7,v 1.1 2014/09/23 23:14:00 blueness Exp $

PIDFILE=/var/run/tor/tor.pid
CONFFILE=/etc/tor/torrc
GRACEFUL_TIMEOUT=${GRACEFUL_TIMEOUT:-60}

# See bug #523552, and https://trac.torproject.org/projects/tor/ticket/5525
# Graceful = wait 30 secs or so until all connections are properly closed.
extra_commands="checkconfig"
extra_started_commands="graceful gracefulstop reload"
description="Anonymizing overlay network for TCP"
description_checkconfig="Check for valid config file."
description_reload="Reload the configuration."
description_graceful="Gracefully restart."
description_gracefulstop="Gracefully stop."

depend() {
        need net
}

checkconfig() {
        # first check that it exists
        if [ ! -f ${CONFFILE} ] ; then
                eerror "You need to setup ${CONFFILE} first"
                eerror "Example is in ${CONFFILE}.sample"
                return 1
	fi

	# now verify whether the configuration is valid
	/usr/bin/tor --verify-config -f ${CONFFILE} > /dev/null 2>&1
	if [ $? -eq 0 ] ; then
		einfo "Tor configuration (${CONFFILE}) is valid."
		return 0
	else
		eerror "Tor configuration (${CONFFILE}) not valid."
		/usr/bin/tor --verify-config -f ${CONFFILE}
		return 1
	fi
}

start() {
	checkconfig || return 1
	checkpath -d -m 0755 -o tor:tor /var/run/tor
        ebegin "Starting Tor"
        HOME=/var/lib/tor
	start-stop-daemon --start --pidfile "${PIDFILE}" --quiet --exec /usr/bin/tor  -- -f "${CONFFILE}" --runasdaemon 1 --PidFile "${PIDFILE}" > /dev/null 2>&1
        eend $?
}

stop() {
        ebegin "Stopping Tor"
	start-stop-daemon --stop --pidfile "${PIDFILE}" --exec /usr/bin/tor -- --PidFile "${PIDFILE}"
        eend $?
}

graceful() {
	gracefulstop
	start
	eend $?
}

gracefulstop() {
        ebegin "Gracefully stopping Tor"
	ebegin "This can take up to ${GRACEFUL_TIMEOUT} seconds"
	start-stop-daemon -P --stop --signal INT -R ${GRACEFUL_TIMEOUT} --pidfile "${PIDFILE}" --exec /usr/bin/tor -- --PidFile "${PIDFILE}"
	eend $?
}

reload() {
	if [ ! -f ${PIDFILE} ]; then
		eerror "${SVCNAME} isn't running"
		return 1
	fi
	checkconfig || return 1
	ebegin "Reloading Tor configuration"
	start-stop-daemon --signal HUP --pidfile ${PIDFILE}
	eend $?
}





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

* [gentoo-commits] gentoo-x86 commit in net-misc/tor/files: tor.initd-r7
@ 2014-12-23 17:26 Anthony G. Basile (blueness)
  0 siblings, 0 replies; 2+ messages in thread
From: Anthony G. Basile (blueness) @ 2014-12-23 17:26 UTC (permalink / raw
  To: gentoo-commits

blueness    14/12/23 17:26:49

  Modified:             tor.initd-r7
  Log:
  Fix cosmetics in tor.initd-r7
  
  (Portage version: 2.2.14/cvs/Linux x86_64, signed Manifest commit with key 0xF52D4BBA)

Revision  Changes    Path
1.2                  net-misc/tor/files/tor.initd-r7

file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/net-misc/tor/files/tor.initd-r7?rev=1.2&view=markup
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/net-misc/tor/files/tor.initd-r7?rev=1.2&content-type=text/plain
diff : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/net-misc/tor/files/tor.initd-r7?r1=1.1&r2=1.2

Index: tor.initd-r7
===================================================================
RCS file: /var/cvsroot/gentoo-x86/net-misc/tor/files/tor.initd-r7,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- tor.initd-r7	23 Sep 2014 23:14:00 -0000	1.1
+++ tor.initd-r7	23 Dec 2014 17:26:49 -0000	1.2
@@ -1,7 +1,7 @@
 #!/sbin/runscript
 # Copyright 1999-2014 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/net-misc/tor/files/tor.initd-r7,v 1.1 2014/09/23 23:14:00 blueness Exp $
+# $Header: /var/cvsroot/gentoo-x86/net-misc/tor/files/tor.initd-r7,v 1.2 2014/12/23 17:26:49 blueness Exp $
 
 PIDFILE=/var/run/tor/tor.pid
 CONFFILE=/etc/tor/torrc
@@ -63,10 +63,13 @@
 }
 
 gracefulstop() {
+	local rc=0
         ebegin "Gracefully stopping Tor"
 	ebegin "This can take up to ${GRACEFUL_TIMEOUT} seconds"
 	start-stop-daemon -P --stop --signal INT -R ${GRACEFUL_TIMEOUT} --pidfile "${PIDFILE}" --exec /usr/bin/tor -- --PidFile "${PIDFILE}"
-	eend $?
+	rc=$?
+	eend "done"
+	eend $rc
 }
 
 reload() {





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

end of thread, other threads:[~2014-12-23 17:26 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-09-23 23:14 [gentoo-commits] gentoo-x86 commit in net-misc/tor/files: tor.initd-r7 Anthony G. Basile (blueness)
  -- strict thread matches above, loose matches on Subject: below --
2014-12-23 17:26 Anthony G. Basile (blueness)

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