Hi Peter & the List,
On Tue, Nov 15, 2011 at 2:40 AM, Peter Wagner <[email protected]> wrote:
> Hi,
>
> the current tor init script that uses the new service wrapper is broken.
It is working fine here. From our discussion on IRC, I suspect your
issue was related to a free space problem on /tmp.
Anyway, looking at your patch, I thought it might me good to have tor
& its initscript share the same idea of what the pid-file is (patch
enclosed)
What do you think ?
Cheers,
--
-{Nico}
From 244bc13134ed5de5e6c727b7a2435ceb47ef3fc9 Mon Sep 17 00:00:00 2001
From: nico <[email protected]>
Date: Tue, 15 Nov 2011 22:41:32 +0100
Subject: [PATCH] packages/tor: use pid-file from tor config-file
Signed-off-by: nico <[email protected]>
---
net/tor/Makefile | 2 +-
net/tor/files/tor.init | 9 ++++++++-
2 files changed, 9 insertions(+), 2 deletions(-)
diff --git a/net/tor/Makefile b/net/tor/Makefile
index b1dc173..10afb50 100644
--- a/net/tor/Makefile
+++ b/net/tor/Makefile
@@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
PKG_NAME:=tor
PKG_VERSION:=0.2.2.34
-PKG_RELEASE:=2
+PKG_RELEASE:=3
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=https://www.torproject.org/dist \
diff --git a/net/tor/files/tor.init b/net/tor/files/tor.init
index 42eff1a..6b8a1bf 100644
--- a/net/tor/files/tor.init
+++ b/net/tor/files/tor.init
@@ -3,7 +3,12 @@
START=50
-SERVICE_PID_FILE=/var/run/tor/tor.pid
+SERVICE_USE_PID=1
+
+lookup_pid_file() {
+ local f="$(cat /etc/tor/torrc |grep '^PidFile' |awk '{ print $2; }' 2>/dev/null)"
+ SERVICE_PID_FILE="${f:-/var/run/tor/tor.pid}"
+}
start() {
user_exists tor 52 || user_add tor 52
@@ -21,9 +26,11 @@ start() {
mkdir -m 0755 -p /var/log/tor
chown tor:tor /var/log/tor
}
+ lookup_pid_file
service_start /usr/sbin/tor
}
stop() {
+ lookup_pid_file
service_stop /usr/sbin/tor
}
--
1.7.0.4
_______________________________________________
openwrt-devel mailing list
[email protected]
https://lists.openwrt.org/mailman/listinfo/openwrt-devel