forked from gentoo/gentoo
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
net-misc/tor: update openrc init scripts, bug #593794
Package-Manager: portage-2.2.28
- Loading branch information
Showing
3 changed files
with
44 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
#!/sbin/openrc-run | ||
# Copyright 1999-2016 Gentoo Foundation | ||
# Distributed under the terms of the GNU General Public License v2 | ||
# $Id$ | ||
|
||
command=/usr/bin/tor | ||
pidfile=/var/run/tor/tor.pid | ||
command_args="--hush --runasdaemon 1 --pidfile \"${pidfile}\"" | ||
retry=${GRACEFUL_TIMEOUT:-60} | ||
|
||
extra_commands="checkconfig" | ||
extra_started_commands="reload" | ||
description="Anonymizing overlay network for TCP" | ||
description_checkconfig="Check for valid config file" | ||
description_reload="Reload the configuration" | ||
|
||
checkconfig() { | ||
${command} --verify-config --hush > /dev/null 2>&1 | ||
if [ $? -ne 0 ] ; then | ||
eerror "Tor configuration (/etc/tor/torrc) is not valid." | ||
eerror "Example is in /etc/tor/torrc.sample" | ||
return 1 | ||
fi | ||
} | ||
|
||
start_pre() { | ||
checkconfig || return 1 | ||
checkpath -d -m 0755 -o tor:tor /var/run/tor | ||
} | ||
|
||
stop() { | ||
ebegin "Stopping Tor (waiting up to ${retry} seconds)" | ||
start-stop-daemon -K -s INT -R ${retry} -P -p ${pidfile} | ||
eend $? | ||
} | ||
|
||
reload() { | ||
checkconfig || return 1 | ||
ebegin "Reloading Tor configuration" | ||
start-stop-daemon -s HUP --pidfile ${pidfile} | ||
eend $? | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters