and added files
[bcm963xx.git] / userapps / opensource / reaim / redhat / etc / init.d / reaim
1 #!/bin/sh
2 #
3 # $Id: reaim,v 1.3 2003/03/26 11:59:30 mark-c Exp $
4
5 #   ReAim startup / shutdown script.  Based on RedHat 8.0 distribution
6 #   scripts for other GPL'd packages.
7 #
8 #   This script is designed for systems that have a user called reaim
9 #   defined, as this id is used for the log file.
10 #
11 #   Linux chkconfig stuff:
12 #
13 #   chkconfig: 2345 50 50
14 #   description: ReAIM Messaging Proxy
15 #
16 #   processname: reaim
17 #   pidfile: /var/run/reaim.pid
18
19 # source function library
20 . /etc/init.d/functions
21
22 RETVAL=0
23 prog="reaim"
24 # Command line flags to the program
25 flags=""
26 LOG_FILE="/var/log/reaim.log"
27 USER_NAME="reaim"
28
29 start() {
30         touch "$LOG_FILE"
31         chown "$USER_NAME" "$LOG_FILE"
32         echo -n $"Starting $prog: "
33         daemon --user "$USER_NAME" "/usr/sbin/$prog" "$flags"
34         RETVAL="$?"
35         echo
36         [ $RETVAL -eq 0 ] && touch /var/lock/subsys/$prog
37         return $RETVAL
38 }
39
40 stop() {
41         echo -n $"Stopping $prog: "
42         killproc $prog
43         RETVAL="$?"
44         echo
45         [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/$prog
46         return $RETVAL
47 }
48
49 reload(){
50         echo -n $"Reloading $prog: "
51         killproc $prog -HUP
52         RETVAL="$?"
53         echo
54         return $RETVAL
55 }
56
57 restart(){
58         stop
59         start
60 }
61
62 condrestart(){
63     [ -e /var/lock/subsys/$prog ] && restart
64     return 0
65 }
66
67 condstop(){
68     [ -e /var/lock/subsys/$prog ] && stop
69     return 0
70 }
71
72 case "$1" in
73   start)
74         start
75         ;;
76   stop)
77         stop
78         ;;
79   restart)
80         restart
81         ;;
82   reload)
83         reload
84         ;;
85   condrestart)
86         condrestart
87         ;;
88   condstop)
89         condstop
90         ;;
91   status)
92         status $prog
93         RETVAL=$?
94         ;;
95   *)
96         echo $"Usage: $0 {start|stop|status|restart|condrestart|condstop|reload}"
97         RETVAL=1
98 esac
99
100 exit $RETVAL