-# see if we can login
-debug "ssh -o PasswordAuthentication=no $desthost -l $destuser 'echo -n 1'"
-if [ ! $test ]; then
- result=`ssh -o PasswordAuthentication=no $desthost -l $destuser 'echo -n 1' 2>&1`
+### vservers stuff ###
+
+# See if vservers are configured.
+# If so, check that the ones listed in $vsnames do exist.
+if [ "$vservers" == "yes" ]; then
+ [ -d "$VROOTDIR" ] || fatal "vservers enabled, but $VROOTDIR does not exist!"
+ if [ "$vsnames" == "all" ]; then
+ vsnames=""
+ for vserver in `ls $VROOTDIR | grep -E -v "lost+found|ARCHIVES"`; do
+ vsnames="$vserver $vsnames"
+ done
+ else
+ for vserver in "$vsnames"; do
+ [ -d "$VROOTDIR/$vserver" ] || fatal "vserver '$vserver' does not exist."
+ done
+ fi
+ if [ -n "$vsnames" ]; then
+ if [ -n "$vsinclude" ]; then
+ info "Using vservers '$vsnames'"
+ usevserver=1
+ fi
+ else
+ [ -z "$vsinclude" ] || warning 'vsnames is empty, vsinclude configuration lines will be ignored'
+ fi
+fi
+
+### see if we can login ###
+
+if [ "$testconnect" == "yes" ]; then
+ debug "ssh $sshoptions -o PasswordAuthentication=no $desthost -l $destuser 'echo -n 1'"
+ if [ ! $test ]; then
+ result=`ssh $sshoptions -o PasswordAuthentication=no $desthost -l $destuser 'echo -n 1'`