aboutsummaryrefslogtreecommitdiff
path: root/net/redsocks/files/redsocks.init
blob: 56c9de327331e098a4e0ba7f4d734579cfe4547e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#!/bin/sh /etc/rc.common
# Copyright (C) 2007 OpenWrt.org

START=90

# check if configuration exists
[ -e "/etc/redsocks.conf" ] || exit 0

start() {
	if [ -e "/var/run/redsocks.pid" ]; then
		echo "redsocks is already running"
		exit 0
	fi

	/bin/echo -n "running redsocks ..."
	
	# startup the safety-wrapper for the daemon
	/usr/sbin/redsocks -p /var/run/redsocks.pid
	
	/bin/echo " done"
}

stop() {
	if [ ! -e "/var/run/redsocks.pid" ]; then
		echo "redsocks is not running"
		exit 0
	fi

	/bin/echo -n "stopping redsocks ..."
	
	# kill the process
	/bin/kill $(cat /var/run/redsocks.pid)
	rm /var/run/redsocks.pid
	
	echo " done"
}