aboutsummaryrefslogtreecommitdiffstats
path: root/community/redsocks/redsocks.initd
diff options
context:
space:
mode:
authorFrancesco Colista <fcolista@alpinelinux.org>2016-08-24 15:55:02 +0000
committerFrancesco Colista <fcolista@alpinelinux.org>2016-08-24 15:55:02 +0000
commit27563f5bfee734648c82e9e9a8e19a7fe545e7fe (patch)
treec5e827b6d2ce9fd9ac26cbb857bcd786205912c6 /community/redsocks/redsocks.initd
parent9d83c6aee5d2f16582dfd678b7e2245bcea3c290 (diff)
downloadaports-27563f5bfee734648c82e9e9a8e19a7fe545e7fe.tar.bz2
aports-27563f5bfee734648c82e9e9a8e19a7fe545e7fe.tar.xz
community/redsocks: moved from testing
Diffstat (limited to 'community/redsocks/redsocks.initd')
-rw-r--r--community/redsocks/redsocks.initd35
1 files changed, 35 insertions, 0 deletions
diff --git a/community/redsocks/redsocks.initd b/community/redsocks/redsocks.initd
new file mode 100644
index 0000000000..592f19385c
--- /dev/null
+++ b/community/redsocks/redsocks.initd
@@ -0,0 +1,35 @@
+#!/sbin/openrc-run
+
+description="Transparent socks redirector"
+
+CFGFILE="/etc/redsocks/${SVCNAME}.conf"
+PIDFILE="/var/run/${SVCNAME}.pid"
+
+depend() {
+ need localmount net
+ use dns logger
+ after bootmisc firewall
+}
+
+checkconfig() {
+ /usr/bin/redsocks -t -c ${CFGFILE}
+ if [ "$?" -gt 0 ]; then
+ eerror "Problem on configuration file ${CFGFILE}"
+ return 1
+ fi
+}
+
+start() {
+ checkconfig || return 1
+ ebegin "Starting ${SVCNAME}"
+ start-stop-daemon --start --exec /usr/bin/redsocks --pidfile "${PIDFILE}" \
+ -- -c "${CFGFILE}" -p "${PIDFILE}"
+ eend $?
+}
+
+stop() {
+ checkconfig || return 1
+ ebegin "Stopping ${SVCNAME}"
+ start-stop-daemon --stop --exec /usr/bin/redsocks --pidfile "${PIDFILE}"
+ eend $?
+}