how to copy my *!&^%# log files

Greg Rundlett greg at buzgate.org
Fri Jun 6 09:25:22 EDT 2003


On Wed, 2003-06-04 at 16:58, John Abreau wrote:


> Looks to me like your cron job isn't finding your ssh-agent instance. 
> A process run from cron isn't going to pick up ssh-agent's environment 
> variables from your user process. 
> 
> You didn't specify the details of what you put into your crontab, so 
> I can't tell exactly what went wrong. The way I usually do this is to 
> dump ssh-agent's environment variables into a file, then use a shell 
> script in cron that sources the file before running ssh. 
> 
> So I'd start up ssh-agent like this: 
> 
>     ssh-agent | head -2 > /usr/home/joe/ssh-agent-id
>     source /usr/home/joe/ssh-agent-id
>     ssh-add
> 
> Then the cron job would run a script like this:
> 
>     #! /bin/bash
>     source /usr/home/joe/ssh-agent-id
>     /usr/bin/scp joe at example.com:/usr/home/joe/www_logs/* /var/log/httpd
> 
> I use the "head -2" because ssh-agent puts an "echo" command after the 
> environment variables it provides, and I don't want that appearing 
> in the sourced file. 

Thanks John, and everyone else for those tips, they helped me greatly.

I ended up adding this to my .bash_profile:

	ssh-agent | head -2 > ~/ssh-agent-id
	source ~/ssh-agent-id
	ssh-add

and using this in my crontab:

	source /home/buzgate/ssh-agent-id

	# then make sure we have all the log files locally
	rsync -vvv --rsh=/usr/bin/ssh
	buzgate at buzgate.org:/usr/home/buzgate/www_logs/* /var/log/httpd

Not sure if I need to be sourcing the ssh-agent-id file again within
cron, but at least it is working :-)  I finally have passwordless cron
between a trusted computer on a trusted network with an untrusted
computer on an untrusted network.


-- 
Greg Rundlett
Sr. Internet Systems Architect
Knowledge Institute
creators of the Business Utility Zone Gateway
at www.buzgate.org
(603) 642-4720
greg.rundlett at buzgate.org




More information about the gnhlug-discuss mailing list