A new form has been added for creating and scheduling a Cron job to run Fetchmail, as an alternative to running the daemon
---- Changes since 1.200 ----
The Scheduled Checking page is now available even when the module is configured to manage Fetchmail for all users on the system, and can setup a Cron job to fetch mail for all users.
+---- Changes since 1.400 ----
+Added an access control option to limit access to the Fetchmail daemon.
print "<tr> <td valign=top><b>$text{'acl_cron'}</b></td> <td>\n";
print &ui_radio("cron", $_[0]->{'cron'},
+ [ [ 1, $text{'yes'} ], [ 0, $text{'no'} ] ]),"</td>\n";
+
+print "<td valign=top><b>$text{'acl_daemon'}</b></td> <td>\n";
+print &ui_radio("daemon", $_[0]->{'daemon'},
[ [ 1, $text{'yes'} ], [ 0, $text{'no'} ] ]),"</td> </tr>\n";
}
$in{'mode'} == 1 ? $in{'userscan'}
: $in{'userscannot'};
$_[0]->{'cron'} = $in{'cron'};
+$_[0]->{'daemon'} = $in{'daemon'};
}
{
local ($config, $user) = @_;
+# Check if we have anything to do
+local @conf = &parse_config_file($config);
+@conf = grep { $_->{'poll'} } @conf;
+return if (!@conf);
+
# Build the command
local $cmd = "$config{'fetchmail_path'} -v -f ".quotemeta($config);
if ($config{'mda_command'}) {
users=
mode=0
cron=1
+daemon=1
require './fetchmail-lib.pl';
&foreign_require("cron", "cron-lib.pl");
-$access{'cron'} || &error($text{'cron_ecannot2'});
+$can_cron || &error($text{'cron_ecannot2'});
&ui_print_header(undef, $text{'cron_title'}, "");
print "$text{'cron_desc'}<p>\n";
print "<tr> <td><b>$text{'poll_is'}</b></td> <td colspan=3>\n";
printf "<input name=is_$i size=60 value='%s'></td> </tr>\n",
- join(" ", @{$u->{'is'}});
+ join(" ", @{$u->{'is'}}) || $remote_user;
print "<tr> <td><b>$text{'poll_keep'}</b></td> <td colspan=3>\n";
printf "<input type=radio name=keep_$i value=1 %s> %s\n",
$cron_cmd = "$user_module_config_directory/check.pl";
$cron_user = $remote_user;
$fetchmail_config = "$remote_user_info[7]/.fetchmailrc";
+ $can_cron = $config{'can_cron'};
+ $can_daemon = $config{'can_daemon'};
}
else {
$cron_cmd = "$module_config_directory/check.pl";
$cron_user = "root";
$fetchmail_config = $config{'config_file'};
+ $can_cron = $access{'cron'};
+ $can_daemon = $access{'daemon'};
}
# parse_config_file(file, [&global])
}
-
1;
acl_only=Only users
acl_except=All except users
acl_cron=Can configure scheduled checking?
+acl_daemon=Can configure Fetchmail daemon?
cron_title=Scheduled Checking
cron_desc=This page can be used to enable or disable a Cron job to check the mail servers in your Fetchmail configuration on a regular schedule. Using a Cron job superior to running the Fetchmail daemon, as it does not need to be re-started at boot time.
require './fetchmail-lib.pl';
&foreign_require("cron", "cron-lib.pl");
-$access{'cron'} || &error($text{'cron_ecannot2'});
+$can_cron || &error($text{'cron_ecannot2'});
&error_setup($text{'cron_err'});
&ReadParse();
&ReadParse();
&error_setup($text{'start_err'});
$config{'config_file'} || $< || &error($text{'start_ecannot'});
+$can_daemon || &error($text{'start_ecannot'});
if ($config{'start_cmd'}) {
$out = &backquote_logged("$config{'start_cmd'} 2>&1");
&ReadParse();
&error_setup($text{'stop_err'});
$config{'config_file'} || $< || &error($text{'stop_ecannot'});
+$can_daemon || &error($text{'start_ecannot'});
if ($config{'stop_cmd'}) {
$out = &backquote_logged("$config{'stop_cmd'} 2>&1");