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