mvhub-dev team mailing list archive
-
mvhub-dev team
-
Mailing list archive
-
Message #00415
[Merge] lp:~omacneil/mvhub/fix_mv-cron into lp:mvhub
Dan MacNeil has proposed merging lp:~omacneil/mvhub/fix_mv-cron into lp:mvhub.
Requested reviews:
MVHub devs with commit rights (mvhub-commit)
see commit log
Big ones: fix bad path so run_external_reports actually runs
delete session files from place they actually are
--
https://code.launchpad.net/~omacneil/mvhub/fix_mv-cron/+merge/29221
Your team MVHub Developers is subscribed to branch lp:mvhub.
=== renamed file 'app-mvhub/setup/etc/cron.daily/clean_slash_tmp_for_mvhub' => 'app-mvhub/bin/rm_session_files'
--- app-mvhub/setup/etc/cron.daily/clean_slash_tmp_for_mvhub 2010-01-14 02:42:50 +0000
+++ app-mvhub/bin/rm_session_files 2010-07-05 16:34:24 +0000
@@ -1,3 +1,14 @@
-#!/bin/bash
-
-rm -rf /tmp/*
+#!/usr/bin/perl
+
+use strict;
+use warnings;
+use autodie qw/system/;
+
+use MVHub::Utils::ConfigSimple;
+
+my $config_file = $ARGV[0] || $ENV{MV_CONFIG_FILE};
+my $CFG = MVHub::Utils::ConfigSimple::create_config_from($config_file);
+my $TMP_DIR = $CFG->param('ABSOLUTE_PATH.tmp_dir');
+
+my $cmd="find $TMP_DIR -mtime +1 -exec rm {} \\;";
+system($cmd);
=== removed file 'app-mvhub/bin/run_mvhub_daily_jobs'
--- app-mvhub/bin/run_mvhub_daily_jobs 2009-09-01 14:49:59 +0000
+++ app-mvhub/bin/run_mvhub_daily_jobs 1970-01-01 00:00:00 +0000
@@ -1,82 +0,0 @@
-#!/usr/bin/perl
-
-# $Revision: 1104 $
-# $Source$
-
-# do stuff for http://mvhub.com that needs to be done every night
-
-use strict;
-use warnings;
-use File::Basename;
-use File::Copy;
-
-my $LOGFILE = '/var/log/'. basename $0 . '.log';
-
-# In addition to the sites in /home/sites, also run reports of:
-my @additional_sites = qw(/home/subs/calendar-mvhub/ );
-
-##### no config needed below #####
-
-{ # main
-
-
- logentry("started run");
-
- mvhub_pdf_directories();
- mvhub_log_slurp();
- generate_mvhub_usage_reports();
-
- logentry("finished run");
-}
-
-sub mvhub_log_slurp {
- logentry("Starting to slurp MVHub server log");
-
- my $cmd = "/home/sites/mvhub2/scripts/guide/weblogslurp.pl";
- system($cmd) == 0 or fatal_logentry("Unable to finish parsing web server logs: $!");
-
- logentry("Finished slurping MVHub server log");
-}
-
-sub generate_mvhub_usage_reports {
- logentry("Starting generation of MVHub per-agency usage reports");
-
- my $cmd = "/home/sites/mvhub2/scripts/guide/generate_agency_usage_reports.pl";
- system($cmd) == 0 or fatal_logentry("Unable to finish generating per-agency usage reports: $!");
-
- logentry("Finished generating MVHub per-agency usage reports");
-}
-
-sub mvhub_pdf_directories {
- logentry("Generating full MVHub PDF");
- my $cmd = "/home/sites/mvhub2/scripts/guide/directory.pl > /dev/null";
- system($cmd) == 0 or
- fatal_logentry("Unable to create full MVHub PDF: $!");
- logentry("Finished generating full MVHub PDF");
-
- logentry("Generating agency-only MVHub PDF");
- $cmd = "/home/sites/mvhub2/scripts/guide/generate_pdf_directory.pl";
- system($cmd) == 0 or
- fatal_logentry("Unable to create agency-only MVHub PDF: $!");
- logentry("Finished generating agency-only MVHub PDF");
-
- logentry("Finished generating MVHub PDFs");
-}
-
-# kludge no locking for example
-sub logentry {
- my $msg = shift;
- open( LOG, '>>', $LOGFILE ) or warn "bad open for append: $! : $LOGFILE\n";
- my $timestamp = `date`;
- chomp $timestamp;
- print LOG "$timestamp | $0 | $$ | $msg\n";
- close(LOG) or warn "bad close: $! : $LOGFILE\n";
-
-}
-
-sub fatal_logentry {
- my $msg = shift;
- $msg = "FATAL ERROR SCRIPT ENDED SUDDENLY: $msg";
- logentry($msg);
- die "$msg\n";
-}
=== modified file 'app-mvhub/setup/etc/cron.d/mvhub-cron'
--- app-mvhub/setup/etc/cron.d/mvhub-cron 2010-06-30 16:25:51 +0000
+++ app-mvhub/setup/etc/cron.d/mvhub-cron 2010-07-05 16:34:24 +0000
@@ -20,11 +20,15 @@
10 0 * * * www-data $BIN_DIR//generate_agency_program_pdf.pl $CONF_DIR/$MVH_CONF_FILE
15 0 * * * www-data $BIN_DIR//generate_agency_program_pdf.pl $CONF_DIR/$NSP_CONF_FILE
- 20 0 * * * www-data $BIN_DIR/run_external_reports.pl $CONF_DIR/$MVH_CONF_FILE
- 25 0 * * * www-data $BIN_DIR/run_external_reports.pl $CONF_DIR/$NSP_CONF_FILE
+ 20 0 * * * www-data $BIN_DIR/run_external_reports $CONF_DIR/$MVH_CONF_FILE
+ 25 0 * * * www-data $BIN_DIR/run_external_reports $CONF_DIR/$NSP_CONF_FILE
+
+ # restarting apache because we rotate/resolved logs and it is
+ # bad karma to keep writing to renamed file
30 0 * * * root /usr/sbin/apache2ctl graceful
- # restarting apache because we rotate/resolved logs and it is
- # bad karma to keep writing to renamed file
+
+ 45 0 * * * root $BIN_DIR/rm_session_files $CONF_DIR/$MVH_CONF_FILE
+ 46 0 * * * root $BIN_DIR/rm_session_files $CONF_DIR/$NSP_CONF_FILE
51 8 1,15 * * www-data $BIN_DIR/notification_email.pl --config=$CONF_DIR/$MVH_CONF_FILE --execute
59 8 1,15 * * www-data $BIN_DIR/notification_email.pl --config=$CONF_DIR/$NSP_CONF_FILE --execute
=== removed directory 'app-mvhub/setup/etc/cron.daily'
Follow ups