]> git.stg.codes - stg.git/blob - projects/stargazer/inst/linux/etc/init.d/stargazer.suse.9.3
Ticket 37. The switch case construction for changePolicy checking
[stg.git] / projects / stargazer / inst / linux / etc / init.d / stargazer.suse.9.3
1 #!/bin/bash
2 #
3 # processname: stargazer
4 # config: /etc/stargazer/stargazer.conf
5 # pidfile: /var/run/stargazer.pid
6
7 # Source function library.
8 . /etc/init.d/functions
9
10 # Source networking configuration.
11 . /etc/sysconfig/network
12
13 # Source stargazer configureation.
14 DAEMON=yes
15 QUEUE=1h
16
17 # Check that networking is up.
18 [ ${NETWORKING} = "no" ] && exit 0
19
20 [ -f /sbin/stargazer ] || exit 0
21
22 RETVAL=0
23 prog="stargazer"
24
25 start() {
26         # Start daemons.
27
28         echo -n $"Starting $prog: "
29         /etc/stargazer/first 2> /dev/null
30         daemon /sbin/stargazer
31         RETVAL=$?
32         /etc/stargazer/last 2> /dev/null
33         echo
34         [ $RETVAL -eq 0 ] && touch /var/lock/subsys/stargazer
35         return $RETVAL
36 }
37
38 stop() {
39         # Stop daemons.
40         echo -n $"Shutting down $prog: "
41         killproc stargazer
42         RETVAL=$?
43         echo
44         [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/stargazer
45         return $RETVAL
46 }
47
48 # See how we were called.
49 case "$1" in
50   start)
51         start
52         ;;
53   stop)
54         stop
55         ;;
56   restart|reload)
57         stop
58         start
59         RETVAL=$?
60         ;;
61   status)
62         status stargazer
63         RETVAL=$?
64         ;;
65   *)
66         echo $"Usage: $0 {start|stop|restart|status}"
67         exit 1
68 esac
69
70 exit $RETVAL