Handle hostnames with upper-case letters
[webmin.git] / webmin / bootup.cgi
1 #!/usr/local/bin/perl
2 # bootup.cgi
3 # Create, enable or disable webmin startup at boot time
4
5 require './webmin-lib.pl';
6 &foreign_require("init", "init-lib.pl");
7 &ReadParse();
8
9 if ($in{'boot'}) {
10         # Enable starting at boot
11         $start = "$config_directory/start";
12         $stop = "$config_directory/stop";
13         $status = <<EOF;
14 pidfile=`grep "^pidfile=" $config_directory/miniserv.conf | sed -e 's/pidfile=//g'`
15 if [ -s \$pidfile ]; then
16         pid=`cat \$pidfile`
17         kill -0 \$pid >/dev/null 2>&1
18         if [ "\$?" = "0" ]; then
19                 echo "webmin (pid \$pid) is running"
20                 RETVAL=0
21         else
22                 echo "webmin is stopped"
23                 RETVAL=1
24         fi
25 else
26         echo "webmin is stopped"
27         RETVAL=1
28 fi
29 EOF
30         &init::enable_at_boot("webmin", "Start or stop Webmin",
31                               $start, $stop, $status);
32         }
33 else {
34         # Disable starting at boot
35         &init::disable_at_boot("webmin");
36         }
37 &redirect("");
38