summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYixun Lan <dlan@gentoo.org>2020-09-27 21:43:35 +0800
committerYixun Lan <dlan@gentoo.org>2020-09-27 21:47:34 +0800
commitaf547811efa07620534f0c5b5d1db5fc75ebcf39 (patch)
treecef5b277dc9771fa60f08169f912fc1c759d73a5 /net-proxy/trojan
parentnet-analyzer/sancp: Old (diff)
downloadgentoo-af547811efa07620534f0c5b5d1db5fc75ebcf39.tar.gz
gentoo-af547811efa07620534f0c5b5d1db5fc75ebcf39.tar.bz2
gentoo-af547811efa07620534f0c5b5d1db5fc75ebcf39.zip
net-proxy/trojan: fix permission with log file
Package-Manager: Portage-3.0.0, Repoman-2.3.23 Signed-off-by: Yixun Lan <dlan@gentoo.org>
Diffstat (limited to 'net-proxy/trojan')
-rw-r--r--net-proxy/trojan/files/trojan.initd16
1 files changed, 10 insertions, 6 deletions
diff --git a/net-proxy/trojan/files/trojan.initd b/net-proxy/trojan/files/trojan.initd
index c87f6576d6bf..348d307c5264 100644
--- a/net-proxy/trojan/files/trojan.initd
+++ b/net-proxy/trojan/files/trojan.initd
@@ -2,6 +2,9 @@
# Copyright 1999-2020 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
+TJ_USER=nobody
+TJ_GROUP=nobody
+
TJ_NAME=${SVCNAME##*.}
if [ -n "${TJ_NAME}" -a "${SVCNAME}" != "trojan" ]; then
TJ_PIDFILE="/run/trojan.${TJ_NAME}.pid"
@@ -19,10 +22,11 @@ depend() {
start() {
ebegin "Starting Trojan, Log File: ${TJ_LOG}"
- start-stop-daemon --start -b \
- --user nobody --group nobody \
- -1 "${TJ_LOG}" -2 "${TJ_LOG}" \
- -m -p "${TJ_PIDFILE}" \
+ checkpath -f -m 0600 -o ${TJ_USER}:${TJ_GROUP} "${TJ_LOG}"
+ start-stop-daemon --start --background \
+ --user ${TJ_USER} --group ${TJ_GROUP} \
+ --stdout "${TJ_LOG}" --stderr "${TJ_LOG}" \
+ --make-pidfile --pidfile "${TJ_PIDFILE}" \
--exec /usr/bin/trojan -- "${TJ_CONFIG}"
eend $?
}
@@ -30,7 +34,7 @@ start() {
stop() {
ebegin "Stopping Trojan"
start-stop-daemon --stop \
- --user nobody --group nobody \
- -p "${TJ_PIDFILE}"
+ --user ${TJ_USER} --group ${TJ_GROUP} \
+ --pidfile "${TJ_PIDFILE}"
eend $?
}