[interchange-cvs] interchange - racke modified 6 files

interchange-core@icdevgroup.org interchange-core@icdevgroup.org
Sun Feb 2 16:05:01 2003


User:      racke
Date:      2003-02-02 21:04:23 GMT
Modified:  .        WHATSNEW
Modified:  lib/Vend Config.pm Control.pm Dispatch.pm Server.pm
Modified:  scripts  interchange.PL
Log:
Renamed Cron configuration directive to Jobs because that is a more
appropriate. Commandline options --job and --cron renamed as well
to --jobgroup and --runjobs.

Revision  Changes    Path
2.94      +4 -0      interchange/WHATSNEW


rev 2.94, prev_rev 2.93
Index: WHATSNEW
===================================================================
RCS file: /var/cvs/interchange/WHATSNEW,v
retrieving revision 2.93
retrieving revision 2.94
diff -u -r2.93 -r2.94
--- WHATSNEW	2 Feb 2003 16:42:15 -0000	2.93
+++ WHATSNEW	2 Feb 2003 21:04:22 -0000	2.94
@@ -22,6 +22,10 @@
 * Remove wrong default for DatabaseDefault, could cause error when a
   DatabaseDefault value had not been previously set.
 
+* Renamed Cron configuration directive to Jobs because that is a more
+  appropriate. Commandline options --job and --cron renamed as well
+  to --jobgroup and --runjobs.
+
 Menu
 ----
 



2.98      +3 -3      interchange/lib/Vend/Config.pm


rev 2.98, prev_rev 2.97
Index: Config.pm
===================================================================
RCS file: /var/cvs/interchange/lib/Vend/Config.pm,v
retrieving revision 2.97
retrieving revision 2.98
diff -u -r2.97 -r2.98
--- Config.pm	27 Jan 2003 16:39:13 -0000	2.97
+++ Config.pm	2 Feb 2003 21:04:22 -0000	2.98
@@ -1,6 +1,6 @@
 # Vend::Config - Configure Interchange
 #
-# $Id: Config.pm,v 2.97 2003/01/27 16:39:13 mheins Exp $
+# $Id: Config.pm,v 2.98 2003/02/02 21:04:22 racke Exp $
 #
 # Copyright (C) 1996-2002 Red Hat, Inc. <interchange@redhat.com>
 # Copyright (C) 2003 ICDEVGROUP <interchange@icdevgroup.org>
@@ -46,7 +46,7 @@
 use Vend::Util;
 use Vend::Data;
 
-$VERSION = substr(q$Revision: 2.97 $, 10);
+$VERSION = substr(q$Revision: 2.98 $, 10);
 
 my %CDname;
 
@@ -500,7 +500,7 @@
 	['DescriptionField', undef,              'description'],
 	['PriceDefault',	 undef,              'price'],
 	['PriceField',		 undef,              'price'],
-	['Cron',		 	 'hash',     	 	 ''],
+	['Jobs',		 	 'hash',     	 	 ''],
 	['Shipping',         'locale',           ''],
 	['Accounting',	 	 'locale',     	 	 ''],
 	['Levies',		 	 'array',     	 	 ''],



2.6       +14 -14    interchange/lib/Vend/Control.pm


rev 2.6, prev_rev 2.5
Index: Control.pm
===================================================================
RCS file: /var/cvs/interchange/lib/Vend/Control.pm,v
retrieving revision 2.5
retrieving revision 2.6
diff -u -r2.5 -r2.6
--- Control.pm	16 Sep 2002 23:06:31 -0000	2.5
+++ Control.pm	2 Feb 2003 21:04:22 -0000	2.6
@@ -1,6 +1,6 @@
 # Vend::Control - Routines that alter the running Interchange daemon
 # 
-# $Id: Control.pm,v 2.5 2002/09/16 23:06:31 mheins Exp $
+# $Id: Control.pm,v 2.6 2003/02/02 21:04:22 racke Exp $
 #
 # Copyright (C) 1996-2002 Red Hat, Inc. <interchange@redhat.com>
 #
@@ -29,7 +29,7 @@
 @EXPORT = qw/
 				signal_reconfig
 				signal_add
-				signal_cron
+				signal_jobs
 				signal_remove
 				control_interchange
 				change_catalog_directive
@@ -50,20 +50,20 @@
 	}
 }
 
-sub signal_cron {
+sub signal_jobs {
 	shift;
-	$Vend::mode = 'cron';
+	$Vend::mode = 'jobs';
 	my $arg = shift;
 	my ($cat, $job) = split /\s*=\s*/, $arg, 2;
-	$Vend::CronCat = $cat;
-#::logGlobal("signal_cron: called cron cat=$cat job=$job");
-	$job = join ",", $job, $Vend::CronJob;
+	$Vend::JobsCat = $cat;
+#::logGlobal("signal_jobs: called cat=$cat job=$job");
+	$job = join ",", $job, $Vend::JobsJob;
 	$job =~ s/^,+//;
 	$job =~ s/,+$//;
-	$Vend::CronJob = $job;
-	Vend::Util::writefile("$Global::RunDir/restart", "cron $cat $job\n");
-#::logGlobal("signal_cron: wrote file, ready to control_interchange");
-	control_interchange('cron', 'HUP');
+	$Vend::JobsJob = $job;
+	Vend::Util::writefile("$Global::RunDir/restart", "jobs $cat $job\n");
+#::logGlobal("signal_jobs: wrote file, ready to control_interchange");
+	control_interchange('jobs', 'HUP');
 }
 
 sub signal_remove {
@@ -110,11 +110,11 @@
 		$sig = $mode ne 'kill' ? 'TERM' : 'KILL';
 	}
 	my $msg;
-	if($mode eq 'cron') {
+	if($mode eq 'jobs') {
 		$msg = errmsg(
 					"Dispatching jobs=%s for cat %s to Interchange server %s with %s.\n",
-					$Vend::CronJob,
-					$Vend::CronCat,
+					$Vend::JobsJob,
+					$Vend::JobsCat,
 					$pid,
 					$sig,
 				);



1.10      +23 -21    interchange/lib/Vend/Dispatch.pm


rev 1.10, prev_rev 1.9
Index: Dispatch.pm
===================================================================
RCS file: /var/cvs/interchange/lib/Vend/Dispatch.pm,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- Dispatch.pm	23 Jan 2003 19:18:47 -0000	1.9
+++ Dispatch.pm	2 Feb 2003 21:04:22 -0000	1.10
@@ -1,6 +1,6 @@
 # Vend::Dispatch - Handle Interchange page requests
 #
-# $Id: Dispatch.pm,v 1.9 2003/01/23 19:18:47 mheins Exp $
+# $Id: Dispatch.pm,v 1.10 2003/02/02 21:04:22 racke Exp $
 #
 # Copyright (C) 2002 ICDEVGROUP <interchange@icdevgroup.org>
 # Copyright (C) 2002 Mike Heins <mike@perusion.net>
@@ -26,7 +26,7 @@
 package Vend::Dispatch;
 
 use vars qw($VERSION);
-$VERSION = substr(q$Revision: 1.9 $, 10);
+$VERSION = substr(q$Revision: 1.10 $, 10);
 
 use POSIX qw(strftime);
 use Vend::Util;
@@ -664,22 +664,22 @@
 	#$Vend::Log_suppress = 1;
 
 	unless ($Vend::Quiet) {
-		logGlobal("Run catalog '%s' cron group=%s", $cat, $job || 'INTERNAL');
+		logGlobal("Run catalog '%s' jobs group=%s", $cat, $job || 'INTERNAL');
 	}
 	#undef $Vend::Log_suppress;
 
 	open_cat($cat);
 
-	logError("Run cron group=%s", $job || 'INTERNAL');
+	logError("Run jobs group=%s", $job || 'INTERNAL');
 
-	my $croncfg = $Vend::Cfg->{Cron};
+	my $jobscfg = $Vend::Cfg->{Jobs};
 
 	my $dir;
 	my @itl;
 	if($job) {
-		my $ct = $croncfg->{base_directory} || 'etc/cron';
+		my $ct = $jobscfg->{base_directory} || 'etc/jobs';
 		my $gt = '';
-		$gt = "$Global::ConfDir/$ct" if $croncfg->{use_global};
+		$gt = "$Global::ConfDir/$ct" if $jobscfg->{use_global};
 
 		for my $d ($ct, $gt) {
 #::logGlobal("check directory=$d for $job");
@@ -693,7 +693,7 @@
 			@f = grep ! -d $_, @f;
 			@f = grep $_ !~ /$Vend::Cfg->{HTMLsuffix}$/, @f;
 			for(@f) {
-#::logGlobal("found cron piece file=$_");
+#::logGlobal("found jobs piece file=$_");
 				push @itl, [$_, readfile($_)];
 			}
 		}
@@ -707,7 +707,7 @@
 
 	if(@itl) {
 		# Run once at beginning
-		run_macro($croncfg->{initialize});
+		run_macro($jobscfg->{initialize});
 
 		# initialize or autoload can create session
 		# but must handle all aspects
@@ -718,45 +718,47 @@
 
 		for(@itl) {
 			# Run once at beginning of each job
-			run_macro($croncfg->{autoload});
+			run_macro($jobscfg->{autoload});
 
 			push @out, interpolate_html($_->[1]);
 		}
 	}
 	else {
-		logGlobal("Empty cron job=%s", $job);
+		logGlobal("Empty job=%s", $job);
 	}
 	my $out = join "", @out;
 	$out =~ s/^\s+//;
 	$out =~ s/\s+$/\n/;
-	$out .= full_dump() if $croncfg->{add_session};
+	$out .= full_dump() if $jobscfg->{add_session};
+
+	logError("Finished jobs group=%s", $job || 'INTERNAL');
 	
 	close_cat();
 
-	# don't send email and/or write log entry if cron job returns
-	# no output (in spirit of the real cron)
+	# don't send email and/or write log entry if job returns
+	# no output (in spirit of the cron daemon)
 	return unless $out;
 	
-	if(my $addr = $Vend::CronEmail || $croncfg->{email}) {
-		my $subject = $croncfg->{subject} || 'Interchange cron results for job: %s';
+	if(my $addr = $Vend::JobsEmail || $jobscfg->{email}) {
+		my $subject = $jobscfg->{subject} || 'Interchange results for job: %s';
 		$subject = errmsg($subject, $job);
-		my $from = $croncfg->{from} || $Vend::Cfg->{MailOrderTo};
+		my $from = $jobscfg->{from} || $Vend::Cfg->{MailOrderTo};
 		Vend::Interpolate::tag_mail($addr,
 									{
 										from => $from,
 										to => $addr,
 										subject => $subject,
-										reply_to => $croncfg->{reply_to},
+										reply_to => $jobscfg->{reply_to},
 										mailer => "Interchange $::VERSION",
-										extra => $croncfg->{extra_headers},
+										extra => $jobscfg->{extra_headers},
 									    log_error => 1,
 									},
 									$out,
 								);
 	}
 
-	if($croncfg->{log}) {
-		logData($croncfg->{log}, $out);
+	if($jobscfg->{log}) {
+		logData($jobscfg->{log}, $out);
 	}
 
 	return $out;



2.26      +11 -11    interchange/lib/Vend/Server.pm


rev 2.26, prev_rev 2.25
Index: Server.pm
===================================================================
RCS file: /var/cvs/interchange/lib/Vend/Server.pm,v
retrieving revision 2.25
retrieving revision 2.26
diff -u -r2.25 -r2.26
--- Server.pm	13 Dec 2002 14:11:35 -0000	2.25
+++ Server.pm	2 Feb 2003 21:04:22 -0000	2.26
@@ -1,6 +1,6 @@
 # Vend::Server - Listen for Interchange CGI requests as a background server
 #
-# $Id: Server.pm,v 2.25 2002/12/13 14:11:35 mheins Exp $
+# $Id: Server.pm,v 2.26 2003/02/02 21:04:22 racke Exp $
 #
 # Copyright (C) 1996-2002 Red Hat, Inc. <interchange@redhat.com>
 #
@@ -25,7 +25,7 @@
 package Vend::Server;
 
 use vars qw($VERSION);
-$VERSION = substr(q$Revision: 2.25 $, 10);
+$VERSION = substr(q$Revision: 2.26 $, 10);
 
 use POSIX qw(setsid strftime);
 use Vend::Util;
@@ -1047,10 +1047,10 @@
 					{
 						::remove_catalog($1);
 					}
-					elsif( $directive =~ /^cron$/i) {
+					elsif( $directive =~ /^jobs$/i) {
 						my ($cat, @jobs) = grep /\S/, split /[\s,\0]+/, $value;
 #::logGlobal("restart line found value='$value'");
-						run_cron($cat, @jobs);
+						run_jobs($cat, @jobs);
 					}
 					else {
 						::change_global_directive($directive, $value);
@@ -2253,27 +2253,27 @@
 		or die "PID $$ conflict: can't lock\n";
 }
 
-sub cron_job {
+sub jobs_job {
 	my ($cat, @jobs) = @_;
 	for my $job (@jobs) {
 		Vend::Dispatch::run_in_catalog($cat, $job);
 	}
 }
 
-sub run_cron {
+sub run_jobs {
 	my ($cat, @jobs) = @_;
 
-#::logGlobal("Vend::Server::run_cron: run cron cat=cat jobs=@jobs");
+#::logGlobal("Vend::Server::run_jobs: run jobs cat=cat jobs=@jobs");
 	my $pid;
 	if($Global::Foreground) {
 		$::Instance = {};
 		eval {
-			cron_job($cat, @jobs);
+			jobs_job($cat, @jobs);
 		};
 		if($@) {
 			my $msg = $@;
 			::logGlobal({ level => 'error' }, "Runtime error: %s" , $msg);
-			logError("Runtime cron error: %s", $msg)
+			logError("Runtime jobs error: %s", $msg)
 				if defined $Vend::Cfg->{ErrorFile};
 		}
 		clean_up_after_fork();
@@ -2293,12 +2293,12 @@
 			eval { 
 				touch_pid() if $Global::PIDcheck;
 				&$Sig_inc;
-				cron_job($cat, @jobs);
+				jobs_job($cat, @jobs);
 			};
 			if ($@) {
 				my $msg = $@;
 				::logGlobal({ level => 'error' }, "Runtime error: %s" , $msg);
-				logError("Runtime cron error: %s", $msg)
+				logError("Runtime jobs error: %s", $msg)
 					if defined $Vend::Cfg->{ErrorFile};
 			}
 			clean_up_after_fork();



2.67      +24 -24    interchange/scripts/interchange.PL


rev 2.67, prev_rev 2.66
Index: interchange.PL
===================================================================
RCS file: /var/cvs/interchange/scripts/interchange.PL,v
retrieving revision 2.66
retrieving revision 2.67
diff -u -r2.66 -r2.67
--- interchange.PL	14 Jan 2003 02:25:54 -0000	2.66
+++ interchange.PL	2 Feb 2003 21:04:23 -0000	2.67
@@ -3,7 +3,7 @@
 #
 # Interchange version 4.9.7
 #
-# $Id: interchange.PL,v 2.66 2003/01/14 02:25:54 mheins Exp $
+# $Id: interchange.PL,v 2.67 2003/02/02 21:04:23 racke Exp $
 #
 # Copyright (C) 1996-2002 Red Hat, Inc. and others.
 # http://www.icdevgroup.org/
@@ -246,7 +246,7 @@
 use autouse 'Vend::Control' => qw/
 											signal_reconfig
 											signal_add
-											signal_cron
+											signal_jobs
 											signal_remove
 											control_interchange
 											remove_catalog
@@ -392,29 +392,29 @@
 The information is in the form of a standard Interchange catalog line,
 and must be in the single-line format.
 
-=item --cron=catalog[=job]
+=item --runjobs=catalog[=job]
 
-Run a cron group which is a series of files in a directory with
+Run a jobs group which is a series of files in a directory with
 the name corresponding to the C<job>. For instance, if you 
 set up a directory called "weekly" in your pages directory
 for the catalog C<foundation>, you can run those files with:
 
-	interchange --cron=foundation=weekly
+	interchange --runjobs=foundation=weekly
 
 Files ending in .html (or whatever HTMLsuffix is for that catalog)
 are skipped. It is not tree-recursive -- directories are ignored.
 
 Results can be emailed to an address if you specify --email=address,
-and they will be put in the cron log file.
+and they will be put in the jobs log file.
 
-Alternatively jobs can be specified with --job=jobname B<before>
-the --cron option. In other words, this will work:
+Alternatively jobs can be specified with --jobgroup=jobname B<before>
+the --runjobs option. In other words, this will work:
 
-	interchange --job=weekly --cron=foundation
+	interchange --jobgroup=weekly --runjobs=foundation
 
 This will NOT work:
 
-	interchange --cron=foundation --job=weekly
+	interchange --runjobs=foundation --jobgroup=weekly
 
 =item -d dir, --dir=dir
 
@@ -428,7 +428,7 @@
 
 =item -email=address
 
-Email address to email cron job results to.
+Email address to email jobs results to.
 
 =item -f file, --config=file
 
@@ -443,14 +443,14 @@
 Run with internet-domain socket only. Normally Interchange runs with
 both UNIX- and internet-domain sockets (except on Windows).
 
-=item --job=job
+=item --jobgroup=job
 
-Sets the job for --cron if that is not included in the --cron
-call. MUST precede the --cron entry on the command line.
+Sets the job for --runjobs if that is not included in the --runjobs
+call. MUST precede the --runjobs entry on the command line.
 
-	interchange --job=weekly --cron=foundation
+	interchange --jobgroup=weekly --runjobs=foundation
 
-See --cron for an explanation of what this does.
+See --runjobs for an explanation of what this does.
 
 =item --kill [signal]
 
@@ -542,8 +542,6 @@
 
      --add=catalog         add a catalog to operation; parms taken from the
                            standard input as a "Catalog ..." directive
-     --cron=catalog[=job]  run cron jobs for a particular catalog
-                           (can use --job and -email)
      -d dir, --dir=dir     directory for VendRoot (interchange.cfg, error.log, etc.)
      -e name,
         --exclude=name     exclude catalog
@@ -553,12 +551,14 @@
      --files spec          filespec (perl regexp OK) for static page tree
      -h, --help            display this message
      -i, --inetmode        run with Internet-domain socket (TCP)
-     --job=jobname         cron jobs to run (hourly, daily, weekly, etc.)
+     --jobgroup=jobname    job group to run (hourly, daily, weekly, etc.)
      --kill [signal]       kill server ungracefully (9 or with optional signal)
      -q, --quiet           suppress informational messages on startup
      --reconfig=catalog    reconfig a particular catalog on the server
      --remove=catalog      remove a catalog from operation
      --restart             restart server
+     --runjobs=catalog[=job]  run jobs for a particular catalog
+                           (can use --jobgroup and -email)
      --serve               start server (default) (-start is alias)
      --stop                stop server gracefully
      -t, --test            report problems with config files
@@ -641,9 +641,9 @@
 		version         => sub { version(); exit 0 },
 		stop			=> \&control_interchange,
 		add				=> \&signal_add,
-		email			=> \$Vend::CronEmail,
-		job				=> \$Vend::CronJob,
-		cron			=> \&signal_cron,
+		email			=> \$Vend::JobsEmail,
+		jobgroup		=> \$Vend::JobsJob,
+		runjobs			=> \&signal_jobs,
 		remove			=> \&signal_remove,
 		kill			=> \&control_interchange,
 		Ignore 			=> \$ignore,
@@ -703,17 +703,17 @@
 		add|a=s
         confdir=s
         configfile|config|c|f=s
-        cron=s
         dir|vendroot|d=s
         email=s
         exclude|e=s
         help|h
         inetmode|inet|i
-        job=s
+        jobgroup=s
         kill:s
         log|logfile|l=s
         quiet|q
         rundir=s
+		runjobs=s
 		pidfile=s
 		reconfig=s
 		remove=s