]>
Commit | Line | Data |
---|---|---|
74fadad4 | 1 | #!/bin/sh |
2 | # | |
3 | # GNUnet Start/Stop GNUnet server | |
4 | # | |
5 | # chkconfig: 345 89 14 | |
60c14db3 | 6 | # description: GNUnet is an anonymous distributed secure network \ |
7 | # this server is required to connect to the network, \ | |
8 | # it will open a TCP port to communicate with the \ | |
9 | # GUI and an UDP port to communicate with the world. \ | |
74fadad4 | 10 | # The configuration file /etc/gnunet.conf will be used. |
11 | # | |
12 | # | |
13 | # Source function library. | |
ce7819dc | 14 | . /etc/rc.d/init.d/functions |
74fadad4 | 15 | |
16 | # Get config. | |
17 | . /etc/sysconfig/network | |
18 | ||
19 | # Check that networking is up. | |
20 | if is_yes "${NETWORKING}"; then | |
3b22996c | 21 | if [ ! -f /var/lock/subsys/network ]; then |
74fadad4 | 22 | msg_network_down "GNUnet" |
23 | exit 1 | |
24 | fi | |
25 | else | |
26 | exit 0 | |
27 | fi | |
28 | ||
29 | # Sanity check | |
30 | [ -e /etc/gnunet.conf ] || exit 0 | |
31 | ||
32 | RETVAL=0 | |
33 | ||
34 | start() { | |
35 | # Check if the service is already running? | |
36 | if [ ! -f /var/lock/subsys/gnunet ]; then | |
37 | msg_starting "GNUnet" | |
38 | daemon gnunetd -u gnunet | |
39 | RETVAL=$? | |
40 | [ $RETVAL -eq 0 ] && touch /var/lock/subsys/gnunet | |
41 | else | |
42 | msg_already_running "GNUnet" | |
43 | fi | |
44 | } | |
45 | ||
46 | stop() { | |
47 | if [ -f /var/lock/subsys/gnunet ]; then | |
48 | msg_stopping "GNUnet" | |
49 | killproc gnunetd | |
50 | rm -f /var/lock/subsys/gnunet >/dev/null 2>&1 | |
51 | else | |
52 | msg_not_running "GNUnet" | |
53 | fi | |
54 | } | |
55 | ||
56 | # See how we were called. | |
57 | case "$1" in | |
58 | start) | |
59 | start | |
60 | ;; | |
61 | stop) | |
62 | stop | |
63 | ;; | |
64 | status) | |
65 | status gnunet | |
66 | ;; | |
67 | restart|reload) | |
68 | stop | |
69 | start | |
70 | ;; | |
71 | *) | |
72 | echo $"Usage: $0 {start|stop|status|restart|reload}" | |
73 | exit 1 | |
74 | esac | |
75 | ||
76 | exit $RETVAL |