]> git.sur5r.net Git - bacula/bacula/blob - gui/bweb/script/starthttp
add a default bconsole command to bweb starthttp script.
[bacula/bacula] / gui / bweb / script / starthttp
1 #!/bin/sh
2
3 # start bweb with lighttpd
4
5 BASE=$(dirname $0)
6
7 if [ -f $PWD/html/bweb.js ]; then
8    BWEBBASE=$PWD
9
10 elif [ -f $PWD/../html/bweb.js ]; then
11     BWEBBASE=$(dirname $PWD)
12
13 elif [ -f $BASE/html/bweb.js ]; then
14     BWEBBASE=$BASE
15
16 else
17     echo "Can't determine bweb installation directory"
18     exit 1
19 fi
20
21 grep /etc/bacula/bweb.conf $BWEBBASE/lib/Bweb.pm > /dev/null
22 if [ $? -eq 0 ]; then
23     echo "Adjusting bweb.conf path"
24     sed -i~ "s:/etc/bacula/bweb.conf:$BWEBBASE/bweb.conf:" $BWEBBASE/lib/Bweb.pm
25 fi
26
27 if [ ! -f $BWEBBASE/bweb.conf ]; then
28     echo "Making configuration template in $BWEBBASE/bweb.conf"
29     cat > $BWEBBASE/bweb.conf <<EOF
30 \$VAR1 = { template_dir => '$PWD/lang',
31            bconsole => 'bconsole -n',
32            fv_write_path => '/tmp/',
33  };
34 EOF
35 fi
36
37 host=$(awk -F'"' '/bind/ { print $2 }' $BWEBBASE/script/httpd.conf)
38 port=$(awk '/port/ { print $3 }' $BWEBBASE/script/httpd.conf)
39
40 echo "Using bweb on $BWEBBASE,  use firefox http://$host:$port"
41 export BWEBBASE
42
43 if [ x$1 = x -o x$1 = xstart ]; then
44     lighttpd -f $BWEBBASE/script/httpd.conf
45
46     if [ $? -ne 0 ]; then
47         echo "Something is wrong with lighttpd, be sure that it is installed"
48         exit $?
49     fi
50 fi
51
52 if [ x$1 = xstop ]; then
53     killall lighttpd
54 fi