---- Changes since 1.440 ----
The search form for jobs is always visible, even when there are not too many jobs to show.
Converted commands in the module's API file to POD format, and added more details about each function.
+---- Changes since 1.480 ----
+Added a Module Config option to add new cron jobs to a specific file, like /etc/cron.d/webmin, instead of users' personal crontab files.
match_user=Match usernames when finding job processes?,1,1-Yes,0-No
kill_subs=Kill sub-processes when terminating jobs?,1,1-Yes,0-No
hourly_only=Only allow jobs to be at most hourly?,1,0-No,1-Yes
+add_file=Add new jobs to file,3,User's regular crontab file
line2=System configuration,11
cron_dir=Crontab Directory,0
cron_get_command=Command to read a user's cron job,0
{
&check_cron_config_or_error();
&list_cron_jobs(); # init cache
-if ($config{'single_file'} && !$config{'cron_dir'}) {
+if ($config{'add_file'}) {
+ # Add to a specific file, typically something like /etc/cron.d/webmin
+ $_[0]->{'type'} = 1;
+ local $lref = &read_file_lines($config{'add_file'});
+ push(@$lref, &cron_job_line($_[0]));
+ &flush_file_lines($config{'add_file'});
+ }
+elsif ($config{'single_file'} && !$config{'cron_dir'}) {
# Add to the single file
$_[0]->{'type'} = 3;
local $lref = &read_file_lines($config{'single_file'});
=cut
sub cron_file
{
-return $_[0]->{'file'} || "$config{'cron_dir'}/$_[0]->{'user'}";
+return $_[0]->{'file'} || $config{'add_file'} ||
+ "$config{'cron_dir'}/$_[0]->{'user'}";
}
=head2 when_text(&job, [upper-case-first])