Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 03 Nov 2005 16:36:03 -0500
From:      Nathan Vidican <nvidican@wmptl.com>
To:        Brandon Hinesley <brandonh@hotandcold.biz>
Cc:        questions@freebsd.org
Subject:   Re: Cron Job will not run.
Message-ID:  <436A82C3.9000708@wmptl.com>
In-Reply-To: <001201c5e0bb$6c81a8b0$6800a8c0@BrandonH>
References:  <001201c5e0bb$6c81a8b0$6800a8c0@BrandonH>

next in thread | previous in thread | raw e-mail | index | archive | help
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@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@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@wmptl.com] 
> Sent: Thursday, November 03, 2005 1:07 PM
> To: Brandon Hinesley
> Cc: questions@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?
> 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?436A82C3.9000708>