]> git.pld-linux.org Git - packages/dante.git/blob - sockd.init
Release 6 (by relup.sh)
[packages/dante.git] / sockd.init
1 #!/bin/sh
2 #
3 # sockd         This shell script takes care of starting and stopping
4 #               the Dante server.
5 #
6 # chkconfig:    2345 65 35
7 # description:  sockd implements a socks v4/v5 proxy server
8 #
9 # processname:  sockd
10 # pidfile:      /var/run/sockd.pid
11
12
13 # Source function library
14 . /etc/rc.d/init.d/functions
15
16 # Get network config
17 . /etc/sysconfig/network
18
19 # Get service config
20 [ -f /etc/sysconfig/sockd ] && . /etc/sysconfig/sockd
21
22 # Check that networking is up.
23 if is_yes "${NETWORKING}"; then
24         if [ ! -f /var/lock/subsys/network -a "$1" != stop -a "$1" != status ]; then
25                 msg_network_down sockdd
26                 exit 1
27         fi
28 else
29         exit 0
30 fi
31
32 start() {
33         # Check if the service is already running?
34         if [ ! -f /var/lock/subsys/sockd ]; then
35                 msg_starting sockd
36                 daemon sockd -D
37                 RETVAL=$?
38                 [ $RETVAL -eq 0 ] && touch /var/lock/subsys/sockd
39         else
40                 msg_already_running sockd
41         fi
42 }
43
44 stop() {
45         if [ -f /var/lock/subsys/sockd ]; then
46                 msg_stopping sockd
47                 killproc sockd
48                 rm -f /var/lock/subsys/sockd /var/run/sockd.pid >/dev/null 2>&1
49         else
50                 msg_not_running sockd
51         fi
52 }
53
54 condrestart() {
55         if [ ! -f /var/lock/subsys/sockd ]; then
56                 msg_not_running sockd
57                 RETVAL=$1
58                 return
59         fi
60         stop
61         start
62 }
63
64 RETVAL=0
65 # See how we were called.
66 case "$1" in
67   start)
68         start
69         ;;
70   stop)
71         stop
72         ;;
73   restart)
74         stop
75         start
76         ;;
77   try-restart)
78         condrestart 0
79         ;;
80   force-reload)
81         condrestart 7
82         ;;
83   status)
84         status sockd
85         exit $?
86         ;;
87   *)
88         msg_usage "$0 {start|stop|restart|try-restart|force-reload|status}"
89         exit 3
90 esac
91
92 exit $RETVAL
This page took 0.092153 seconds and 3 git commands to generate.