-[ -d $backupdir ] || mkdir -p $backupdir
-[ -d $backupdir ] || fatal "Backup directory '$backupdir'"
+# If vservers are configured, decide if the handler should
+# use them or if it should just operate on the host
+
+if [ "$vservers" = "yes" ]
+then
+ if [ ! -z $vsname ]
+ then
+ info "Using vserver '$vsname'"
+ usevserver=1
+ else
+ info "No vserver name specified, actions will be performed on the host"
+ fi
+fi
+
+# Check to make sure that the specified vserver exists
+if [ $usevserver ]
+then
+ vroot="$VROOTDIR/$vsname"
+ [ -d $vroot ] || fatal "vserver '$vsname' does not exist at '$vroot'"
+fi
+
+# create backup dirs, the vroot variable will be empty if no vsname was specified
+# and will proceed to operate on the host
+[ -d $vroot$backupdir ] || mkdir -p $vroot$backupdir
+[ -d $vroot$backupdir ] || fatal "Backup directory '$vroot$backupdir'"