Handle hostnames with upper-case letters
[webmin.git] / fetchmail / start.cgi
1 #!/usr/local/bin/perl
2 # start.cgi
3 # Start the fetchmail daemon
4
5 require './fetchmail-lib.pl';
6 &ReadParse();
7 &error_setup($text{'start_err'});
8 $config{'config_file'} || $< || &error($text{'start_ecannot'});
9 $can_daemon || &error($text{'start_ecannot'});
10
11 if ($config{'start_cmd'}) {
12         $out = &backquote_logged("$config{'start_cmd'} 2>&1");
13         }
14 else {
15         $in{'interval'} =~ /^\d+$/ || &error($text{'start_einterval'});
16         $mda = " -m '$config{'mda_command'}'" if ($config{'mda_command'});
17         if ($< == 0) {
18                 if ($config{'daemon_user'} eq 'root') {
19                         $out = &backquote_logged("$config{'fetchmail_path'} -d $in{'interval'} -f $config{'config_file'} $mda 2>&1");
20                         }
21                 else {
22                         $out = &backquote_logged("su - '$config{'daemon_user'}' -c '$config{'fetchmail_path'} -d $in{'interval'} -f $config{'config_file'} $mda' 2>&1");
23                         }
24                 }
25         else {
26                 $out = &backquote_logged("$config{'fetchmail_path'} -d $in{'interval'} $mda 2>&1");
27                 }
28         }
29 if ($?) {
30         &error("<tt>$out</tt>");
31         }
32 &webmin_log("start", undef, undef, \%in);
33 &redirect("");
34