hi,
i use the following script to connect to some dmz-servers in
runbeforejob.
if i run the job manually it works always, but if the scheduler runs it
at
night, all the jobs with this script always get stuck until i kill the
"[ssh-tunnel.sh] <defunct>" proecesses.
after that the queued jobs for the same clients, with the same
runbeforejob,
run fine.
while it waits the tunnel itself opens fine, but it looks like that the
script
doesn't exit becouse ssh waits for something...
any ideas how to fix that?
------------
#!/bin/sh
# variables
USER=bacula
CLIENT=$2
LOCAL=bla.domain.tld
SSH=/usr/bin/ssh
case "$1" in
start)
# create ssh-tunnel
echo "Starting SSH-tunnel to $CLIENT..."
exec &>/dev/null
$SSH -fnN2 -o PreferredAuthentications=publickey -i
/var/lib/bacula/.ssh/id_dsa -l $USER -R 9103:$LOCAL:9103 $CLIENT >
/dev/null 2> /dev/null
exit $?
;;
stop)
# remove tunnel
echo "Stopping SSH-tunnel to $CLIENT..."
# find PID killem
PID=`ps ax | grep "/usr/bin/ssh" | grep
"/var/lib/bacula/.ssh/id_dsa" | grep "$CLIENT" | awk '{ print $1 }'`
kill $PID
exit 0;
;;
*)
# usage:
echo " "
echo " Start SSH-tunnel to client-host"
echo " to bacula-director and storage-daemon"
echo " "
echo " USAGE:"
echo " ssh-tunnel.sh {start|stop} client.fqdn"
echo ""
exit 1
;;
esac
------------
regards,
michael
-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference
Don't miss this year's exciting event. There's still time to save $100.
Use priority code J8TL2D2.
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________
Bacula-users mailing list
Bacula-users AT lists.sourceforge DOT net
https://lists.sourceforge.net/lists/listinfo/bacula-users
|