aboutsummaryrefslogtreecommitdiffstats
path: root/testing/redsocks/redsocks.initd
diff options
context:
space:
mode:
Diffstat (limited to 'testing/redsocks/redsocks.initd')
-rw-r--r--testing/redsocks/redsocks.initd35
1 files changed, 35 insertions, 0 deletions
diff --git a/testing/redsocks/redsocks.initd b/testing/redsocks/redsocks.initd
new file mode 100644
index 0000000000..592f19385c
--- /dev/null
+++ b/testing/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 $?
+}