Imported Upstream version 20070115
[aiccu.git] / doc / aiccu.init.rpm
blobb80271afed5c8c0b053d798cb1acf852eec2af33
1 #!/bin/sh
3 # description: Starts and stops the AICCU daemon
5 # aiccu: Starts and stops the AICCU daemon
6 # description: hearbeat daemon for IPv6-in-IPv4 (Proto-41, AYIYA, Heartbeat) tunnels
7 # pidfile: /var/run/aiccu.pid
8 # config:  /etc/aiccu.conf
9 # chkconfig: - 59 73
10 # processname: aiccu
12 # Source function library.
13 if [ -f /etc/init.d/functions ] ; then
14   . /etc/init.d/functions
15 elif [ -f /etc/rc.d/init.d/functions ] ; then
16   . /etc/rc.d/init.d/functions
17 else
18   exit 0
21 # Avoid using root's TMPDIR
22 unset TMPDIR
24 # Source networking configuration.
25 . /etc/sysconfig/network
27 # Default options
28 OPTIONS=
30 if [ -f /etc/sysconfig/aiccu ]; then
31    . /etc/sysconfig/aiccu
34 # Check that networking is up.
35 [ ${NETWORKING} = "no" ] && exit 0
37 # Check that aiccu.conf exists.
38 [ -f /etc/aiccu.conf ] || exit 0
40 # Verify that the configuration is correct
41 if [ `grep -c "^username" /etc/aiccu.conf 2>/dev/null` -ne 1 ]; then
42         echo "AICCU is not configured, edit /etc/aiccu.conf first"
43         exit 0;
46 RETVAL=0
48 KIND="AICCU (Automatic IPv6 Connectivity Configuration Utility)"
50 start() {
51         echo -n $"Starting $KIND services: "
52         daemon aiccu start $OPTIONS
53         RETVAL=$?
54         echo
55         [ $RETVAL -eq 0  ] && touch /var/lock/subsys/aiccu || \
56            RETVAL=1
57         return $RETVAL
58 }       
60 stop() {
61         echo -n $"Shutting down $KIND services: "
62         killproc aiccu
63         RETVAL=$?
64         echo
65         [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/aiccu
66         echo ""
67         return $RETVAL
68 }       
70 restart() {
71         stop
72         start
73 }       
75 rhstatus() {
76         status aiccu
77 }       
80 case "$1" in
81   start)
82         start
83         ;;
84   stop)
85         stop
86         ;;
87   restart)
88         restart
89         ;;
90   reload)
91         restart
92         ;;
93   status)
94         rhstatus
95         ;;
96   condrestart)
97         [ -f /var/lock/subsys/aiccu ] && restart || :
98         ;;
99   *)
100         echo $"Usage: $0 {start|stop|restart|reload|status|condrestart}"
101         exit 1
102 esac
104 exit $?