OSDN Git Service

Fix no pic
[uclinux-h8/uClinux-dist.git] / user / gnugk / gk.initd.freebsd
1 #!/bin/sh
2 #
3 # gnugk         This shell script takes care of starting and stopping
4 #               gnugk (Openh323 Gatekeeper - GNU Gatekeeper daemon)
5 #
6 # Coded by Dariusz Wrebiak <dariusz.wrebiak@cstnet.com.pl>
7 #
8 #               Cyfrowe Systemy Telekomunikacyjne Sp z O.O.
9 #               ul. Szkotnik 2B, 33-100 Tarnow
10 #               Poland
11 #               tel: (+048) 146376600
12 #               fax: (+048) 146376621
13 #               www: http://cstnet.com.pl
14 #               e-mail: office@cstnet.com.pl
15 #
16
17 GNUGK=/usr/sbin/gnugk
18 GKPID=/var/run/gnugk.pid
19 GKCONFIG=/etc/gnugk.ini
20 LOGFILE=/var/log/gk.log
21
22 if [ ! -x $GNUGK ] ; then
23   echo "$GNUGK: No such file!"
24   exit 0
25 fi
26
27 if [ ! -f $GKCONFIG ] ; then
28   echo "$GKCONFIG: No such file!"
29   exit 0
30 fi
31
32 start() {
33   if [ -f $GKPID ] ; then
34     echo "$GNUGK is running!"
35     exit 0
36   fi
37   if [ -f $LOGFILE ] ; then
38     mv $LOGFILE $LOGFILE.old
39   fi
40   echo -n "Starting $GNUGK: "
41   $GNUGK -c $GKCONFIG -o $LOGFILE > /dev/null 2>&1 &
42   echo ""
43 }
44
45 stop() {
46   if [ ! -f $GKPID ] ; then
47     echo "$GNUGK is not running!"
48     exit 0
49   fi
50   echo -n "Stopping $GNUGK: "
51   kill -9 "`cat $GKPID`"
52   rm -rf $GKPID
53   echo ""
54 }
55
56 restart() {
57   stop
58   start
59 }
60
61 case "$1" in
62   start)
63     start
64     exit 0
65     ;;
66   stop)
67     stop
68     exit 0
69     ;;
70   restart)
71     restart
72     exit 0
73     ;;
74   *)
75     echo "Usage: $0 {start|stop|restart}"
76     exit 0
77 esac 
78