3 # Start the fetchmail daemon
5 require './fetchmail-lib.pl';
7 &error_setup($text{'start_err'});
8 $config{'config_file'} || $< || &error($text{'start_ecannot'});
9 $can_daemon || &error($text{'start_ecannot'});
11 if ($config{'start_cmd'}) {
12 $out = &backquote_logged("$config{'start_cmd'} 2>&1");
15 $in{'interval'} =~ /^\d+$/ || &error($text{'start_einterval'});
16 $mda = " -m '$config{'mda_command'}'" if ($config{'mda_command'});
18 if ($config{'daemon_user'} eq 'root') {
19 $out = &backquote_logged("$config{'fetchmail_path'} -d $in{'interval'} -f $config{'config_file'} $mda 2>&1");
22 $out = &backquote_logged("su - '$config{'daemon_user'}' -c '$config{'fetchmail_path'} -d $in{'interval'} -f $config{'config_file'} $mda' 2>&1");
26 $out = &backquote_logged("$config{'fetchmail_path'} -d $in{'interval'} $mda 2>&1");
30 &error("<tt>$out</tt>");
32 &webmin_log("start", undef, undef, \%in);