X-Git-Url: http://git.linux-vserver.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=util-vserver%2Fscripts%2Fvserver-copy;h=a2c15901f2f3c8d133f08655e77d2649e0b80983;hb=02cbc32100a68bb145bfabfbef847359e2343205;hp=deb6f9f0871103f260e1db55149165dfc2de23aa;hpb=da691fd4bad5e187b307b7fd86bf5fd61e47c3fc;p=util-vserver.git diff --git a/util-vserver/scripts/vserver-copy b/util-vserver/scripts/vserver-copy index deb6f9f..a2c1590 100755 --- a/util-vserver/scripts/vserver-copy +++ b/util-vserver/scripts/vserver-copy @@ -36,6 +36,13 @@ # used so that if/when you reboot the source roothost you don't have the # same vserver and IP address running on two machines. +: ${UTIL_VSERVER_VARS:=/usr/lib/util-vserver/util-vserver-vars} +test -e "$UTIL_VSERVER_VARS" || { + echo "Can not find util-vserver installation; aborting..." >&2 + exit 1 +} +. "$UTIL_VSERVER_VARS" + VERSION="0.4" umask 022 me=${0##*/} @@ -92,7 +99,7 @@ flag a vserver can even be operationally moved to different hardware within seconds. The -i and -d flags can be used to minimally reconfigure the destination -vserver (rewrites /etc/vservers/newname.conf and /vservers/newname/etc/hosts) +vserver (rewrites /etc/vservers/newname.conf and $DEFAULT_VSERVERDIR/newname/etc/hosts) Options: -h, --help this help @@ -136,7 +143,7 @@ rsh=(false) colon=":" domain="" ip="" -vsroot="/vservers" +vsroot=$DEFAULT_VSERVERDIR if [ $# -eq 0 ]; then # Script invoked with no command-line args? usage @@ -271,7 +278,7 @@ if [ -n "$ip" ] && \ fi # This works both locally and remote -if ($shcmd $dhost /usr/sbin/vserver $newname running | grep 'is running'); then +if ($shcmd $dhost $SBINDIR/vserver $newname running | grep 'is running'); then warn "destination vserver \"$newname\" is running" error 1 "Cannot copy over a running vserver" fi @@ -283,7 +290,7 @@ info "Attempting to copy $vserver to $dhost$colon$newname" if $stopstart; then info "Stopping virtual server \"$vserver\" on localhost" - /usr/sbin/vserver $vserver stop + $SBINDIR/vserver $vserver stop fi info "Syncing directories" @@ -358,8 +365,8 @@ fi if $stopstart; then info "Starting virtual server \"$vserver\" on $dhost" - $shcmd $dhost /usr/sbin/vserver $vserver start - if ($shcmd $dhost /usr/sbin/vserver $vserver running | \ + $shcmd $dhost $SBINDIR/vserver $vserver start + if ($shcmd $dhost $SBINDIR/vserver $vserver running | \ grep 'not running'); then error 1 "Virtual server \"$vserver\" failed to start on $dhost" fi