Handle hostnames with upper-case letters
[webmin.git] / cron / cron_editor.pl
1 #!/usr/local/bin/perl
2 # cron_editor.pl
3 # Called by crontab -e to edit an users cron table.. 
4
5 sleep(1);       # This is needed because the stupid crontab -e command
6                 # checks the mtime before and after editing, and if they are
7                 # the same it assumes no change has been made!!
8 open(SRC, $ENV{"CRON_EDITOR_COPY"});
9 open(DST, ">$ARGV[0]") || die "Failed to open $ARGV[0] : $!";
10 while(<SRC>) {
11         if (!/^#.*DO NOT EDIT/i && !/^#.*installed on/i &&
12             !/^#.*Cron version/i) {
13                 (print DST $_) || die "Failed to write to $ARGV[0] : $!";
14                 }
15         }
16 close(SRC);
17 close(DST) || die "Failed to write to $ARGV[0] : $!";