-# see if we can login
-debug "su $sourceuser -c \"ssh -o PasswordAuthentication=no $desthost -l $destuser 'echo -n 1'\""
-if [ ! $test ]; then
- result=`su $sourceuser -c "ssh -o PasswordAuthentication=no $desthost -l $destuser 'echo -n 1'" 2>&1`
- if [ "$result" != "1" ]; then
- fatal "Can't connect to $desthost as $destuser."
+if [ "$desttype" == "remote" ]; then
+ # see if we can login
+ if [ "$testconnect" == "yes" ]; then
+ hostalive=0
+ debug "ssh -o PasswordAuthentication=no $desthost -l $destuser 'echo -n 1'"
+ ret=`ssh -o PasswordAuthentication=no $desthost -l $destuser 'echo -n host is alive'`
+ if echo $ret | grep "host is alive"; then
+ debug "Connected to $desthost as $destuser successfully"
+ else
+ fatal "Can't connect to $desthost as $destuser."
+ fi