]> git.sur5r.net Git - bacula/bacula/blob - gui/baculum/examples/rpm-template/baculum.startup
baculum: Improve Makefile to use templates data
[bacula/bacula] / gui / baculum / examples / rpm-template / baculum.startup
1 #!/bin/sh
2 #
3 # chkconfig: 2345 91 9
4 # description: This script uses Lighttpd web server for \
5 #              working Baculum WebGUI tool.
6 #
7
8 ### BEGIN INIT INFO
9 # Provides:          baculum
10 # Required-Start:    $local_fs $remote_fs $network $syslog $named
11 # Required-Stop:     $local_fs $remote_fs $network $syslog $named
12 # Default-Start:     2 3 4 5
13 # Default-Stop:      0 1 6
14 # Short-Description: Start/stop Baculum
15 # Description:       Start the Baculum WebGUI Bacula Community tool.
16 ### END INIT INFO
17
18 DESC="Baculum WebGUI Bacula Community tool"
19 NAME=baculum
20 SCRIPTNAME=/etc/init.d/$NAME
21 DAEMON=/usr/sbin/lighttpd
22 DAEMON_OPTS="-f /etc/baculum/baculum.lighttpd.conf"
23 PIDFILE=/var/run/$NAME.pid
24 LOCKFILE=/var/lock/subsys/$NAME
25
26 test -x $DAEMON || exit 0
27
28 check_syntax()
29 {
30     $DAEMON -t $DAEMON_OPTS > /dev/null || exit $?
31 }
32
33 log_daemon_msg()
34 {
35     logger "$@"
36 }
37
38 log_end_msg()
39 {
40     [ $1 -eq 0 ] && RES=OK
41     logger ${RES:=FAIL}
42 }
43
44 rh_status() {
45     status $prog
46 }
47
48 if test -f /lib/lsb/init-functions; then
49 . /lib/lsb/init-functions
50 fi
51
52 . /etc/init.d/functions
53
54 case "$1" in
55     start)
56         check_syntax
57         log_daemon_msg "Starting $DESC" $NAME
58         if ! ${DAEMON} $DAEMON_OPTS
59         then
60             log_end_msg 1
61         else
62             log_end_msg 0
63             touch $LOCKFILE
64         fi
65         ;;
66     stop)
67         log_daemon_msg "Stopping $DESC" $NAME
68         if kill -TERM `<$PIDFILE`
69         then
70             rm -f $PIDFILE
71             rm -f $LOCKFILE
72             log_end_msg 0
73         else
74             log_end_msg 1
75         fi
76         ;;
77     status)
78         rh_status
79         ;;
80     restart)
81         check_syntax
82         $0 stop
83         $0 start
84         ;;
85     *)
86         echo "Usage: $SCRIPTNAME {start|stop|restart|status}" >&2
87         exit 1
88         ;;
89 esac
90
91 exit 0