Cron Job will not run.

Nathan Vidican nvidican at wmptl.com
Thu Nov 3 21:36:05 GMT 2005


lol - sorry to point out the obvious, but ya never know ;) - have seen 
worse/done worse myself...

Anyhow, try modifying the script so it just outputs something to the console, 
see if cron logs/emails the output or not, then take it step-by-step from there; 
have it actually print out/echo the command(s) your script will run, then you 
can verify the command works on the console, then go from there.

I have a (rather complex) backup script using rsync, written in Perl (yeah, I 
know I could have done what I did using shell or a cleaner setup - just Perl is 
easier ;) I synchronize serveral directories to effectively mirror a partition 
accross two data servers (/server, from server1 to server2). Here's my script 
for what it may be worth:

#!/usr/bin/perl -w

use strict;
use lib '/server/modules';

my $verbose = defined($ARGV[0]);
# pairs go: /server/{src/key} = /server/{dst/value}
# eg: 'profiles' => '' = /server/profiles (remote) to /server (local)

my %dirs = (	'profiles'=>'',
		'common'=>'',
		'msword'=>'',
		'qs9000'=>'',
		'quattro'=>'',
		'exe'=>'',
		'users'=>'',
		'netlogon'=>'' );

open(LOG,">/var/log/rsync_nightly.log") || die "Couldn't create log file!\n";

foreach my $src (keys %dirs) {
	my $output = `/usr/local/bin/rsync -va --stats --delete 
rsync://server2/server/$src /server/$dirs{$src}`;
	print LOG $output;
	print $output if ($verbose);
}
close(LOG);
exit;


-- 
Nathan Vidican
nvidican at wmptl.com
Windsor Match Plate & Tool Ltd.
http://www.wmptl.com/


Brandon Hinesley wrote:
> If it's not, then someone's inserting things into my /var/log/cron!
> 
> 
>>Here's some of /var/log/cron:
>>--------------------
>>Nov  3 09:00:00 server /usr/sbin/cron[56343]: (operator) CMD
>>(/usr/libexec/save-entropy) Nov  3 09:00:00 server /usr/sbin/cron[56344]:
>>(root) CMD (/usr/libexec/atrun) Nov  3 09:00:00 server
>>/usr/sbin/cron[56345]: (root) CMD (/usr/local/Backup/scripts/bkup-daily)
> 
> 
> Kidding...yes it's running:
> root at server# ps ax | grep cron
>   472  ??  Is     0:02.20 /usr/sbin/cron -s
> 57450  p0  R+     0:00.00 grep cron
> 
> Thanks
> 
> -----Original Message-----
> From: Nathan Vidican [mailto:nvidican at wmptl.com] 
> Sent: Thursday, November 03, 2005 1:07 PM
> To: Brandon Hinesley
> Cc: questions at freebsd.org
> Subject: Re: Cron Job will not run.
> 
> May be a really dumb question here, but like all technical problems, start
> with 
> the simple stuff:
> 
> ps ax | grep cron   ????
> 
> Is cron even running?
> 


More information about the freebsd-questions mailing list