[Fusionforge-commits] r7049 - trunk/tools

Alain Peyrat aljeux at libremir.placard.fr.eu.org
Tue Feb 24 00:30:55 CET 2009


Author: aljeux
Date: 2009-02-24 00:30:55 +0100 (Tue, 24 Feb 2009)
New Revision: 7049

Added:
   trunk/tools/simulate_cron.pl
Log:
Add simulate_cron.pl in tools (simple script to run cron jobs)

Added: trunk/tools/simulate_cron.pl
===================================================================
--- trunk/tools/simulate_cron.pl	                        (rev 0)
+++ trunk/tools/simulate_cron.pl	2009-02-23 23:30:55 UTC (rev 7049)
@@ -0,0 +1,29 @@
+#!/usr/bin/perl -w
+# 
+# Simple script to run all crons (for tests) 
+#
+# Author: aljeux <aljeux at free.fr>
+#
+
+use strict;
+
+my $file = shift;
+
+open(F, $file) || die "Unable to open file '$file': $!";
+while (<F>) {
+ next if /^\s*#/;
+ next if /^\s*$/;
+ if (/^([A-Z]+)="(.*)"/) {
+  $ENV{$1}=$2;
+  print "Loading $1=$2\n";
+ }
+ if (/\S+\s+\S+\s+\S+\s+\S+\s+\S+\s+root\s+(.*)/) {
+  print "Running $1 (as root)\n";
+  system($1);
+ }
+ if (/\S+\s+\S+\s+\S+\s+\S+\s+\S+\s+gforge\s+(.*)/) {
+  print "Running $1 (as gforge)\n";
+  system('su', 'gforge', '-c', $1);
+ }
+}
+close(F);




More information about the Fusionforge-commits mailing list