[Nelug] cron and ssh

Andrew Hatch andrew.hatch at bluespace.com
Mon Sep 22 15:01:01 UTC 2003


Beginning to tear my hair out a little on this one.  I have the following
script:

----------------
#!/bin/bash
USERA="auser"
USERB="buser"
HOSTA="hosta"
HOSTB="hostb"
DEST="/tmp"
F="/path/to/myfile.dat"
FF="/path/to/someother/myfile.dat"

ssh -i /path/to/.ssh/id_dsa $USERA@$HOSTA "ssh $USERB@$HOSTB cp $F $FF"
-----------------

Now, executed at the command line - this works fine.  Executed via cron,
however, the script does cause the file $F to be copied on $HOSTB, but the
command does not return, so the rest of the script isn't executed until I
kill -TERM pid for that process.

Any ideas why this script will work fine on a command line, but not return
when the script is executed via cron?  The mail I get back from cron is:

---------------------
Killed by signal 15.
---------------------

because I killed the process.  Is there some way I can discover what the
problem is with ssh?

Many thanks in advance!

Andrew





More information about the Nelug mailing list