prevent-maintenance.pl 849 B

12345678910111213141516171819202122232425
  1. #! /usr/bin/perl -w
  2. use CGI qw/:standard/;
  3. use CGI::Carp qw(fatalsToBrowser);
  4. print header() . start_html(), p;
  5. print 'Stop maintenance: $Id: prevent-maintenance.pl,v 1.1 2003/11/16 21:35:51 as Exp $', "\n";
  6. if (not param('dir')) {
  7. print start_form, p,
  8. '$DataDir: ', textfield('dir', '/tmp/oddmuse'),
  9. p, submit('Ok'), "\n", end_form;
  10. } elsif (param('dir') and not param('sure')) {
  11. print start_form, hidden('sure', 'yes'), hidden('dir', param('dir')),
  12. '$DataDir: ', param('dir'),
  13. p, submit('Confirm'), "\n", end_form;
  14. } else {
  15. $time = (time) + 28 * 24 * 3600; # four weeks
  16. $file = param('dir') . "/maintain";
  17. open(F, ">$file") or die "Unable to create maintenance file";
  18. print F "Preventing maintenance until " . gmtime($time);
  19. close(F);
  20. utime $time, $time, $file;
  21. print pre(`ls -l $file`);
  22. }
  23. print end_html();