If there are more than 100 jobs (by default), a search form is shown on the main page instead of a list of all jobs.
Re-wrote all user interface code to use the new Webmin UI library.
Handle the daily / monthly / weekly Cron specification used on Ubuntu 7.
+---- Changes since 1.400 ----
+Fixed a bug that prevented new cron jobs from being created unless the 'Date range to execute' setting was changed.
+Added a check for a valid module configuration, especially the cron jobs directory, to prevent accidental deletion of jobs.
# Add a Cron job to a user's file
sub create_cron_job
{
+&check_cron_config_or_error();
&list_cron_jobs(); # init cache
if ($config{'single_file'} && !$config{'cron_dir'}) {
# Add to the single file
# Add a Cron job at the top of the user's file
sub insert_cron_job
{
+&check_cron_config_or_error();
&list_cron_jobs(); # init cache
if ($config{'single_file'} && !$config{'cron_dir'}) {
# Insert into single file
return 0;
}
+# check_cron_config()
+# Returns an error message if the cron config doesn't look valid
+sub check_cron_config
+{
+# Check for single file and getter command
+if ($config{'single_file'} && !-r $config{'single_file'}) {
+ return &text('index_esingle', "<tt>$config{'single_file'}</tt>");
+ }
+if ($config{'cron_get_command'} =~ /^(\S+)/ && !&has_command("$1")) {
+ return &text('index_ecmd', "<tt>$1</tt>");
+ }
+# Check for directory
+local $fcron = ($config{'cron_dir'} =~ /\/fcron$/);
+if (!$single_user && !$fcron && !-d $config{'cron_dir'}) {
+ return &text('index_ecrondir', "<tt>$config{'cron_dir'}</tt>");
+ }
+return undef;
+}
+
+sub check_cron_config_or_error
+{
+local $err = &check_cron_config();
+if ($err) {
+ &error(&text('index_econfigcheck', $err));
+ }
+}
+
1;
$max_jobs = $userconfig{'max_jobs'} || $config{'max_jobs'};
# Make sure cron is installed (very likely!)
-if ($config{'single_file'} && !-r $config{'single_file'}) {
- $err = &text('index_esingle', "<tt>$config{'single_file'}</tt>");
- }
-if ($config{'cron_get_command'} =~ /^(\S+)/ && !&has_command("$1")) {
- $err = &text('index_ecmd', "<tt>$1</tt>");
- }
+$err = &check_cron_config();
if ($err) {
print $err,"<p>\n";
&ui_print_footer("/", $text{'index'});
index_run=Running?
index_ecmd=The command $1 for managing user Cron configurations was not found. Maybe Cron is not installed on this system?
index_esingle=The file $1 listing Cron jobs does not exist. Maybe Cron is not installed on this system?
+index_ecrondir=The Cron jobs directory $1 does not exist. Maybe the module's configuration is incorrect, or Cron is not installed?
index_delete=Delete Selected Jobs
index_disable=Disable Selected Jobs
index_enable=Enable Selected Jobs
index_ok=Search
index_searchres=Cron jobs matching $1 ..
index_reset=Reset search.
+index_econfigcheck=Cron jobs cannot be managed on your system, as the module configuration is not valid : $1
edit_title=Edit Cron Job
create_title=Create Cron Job