Commit 74b041e0 authored by Vitaly Lipatov's avatar Vitaly Lipatov

add vzarchive scripts

parent c2e8f1c9
#!/bin/bash
SERVER=$1
DESTINATION=/var/ftp/pvt/Etersoft/ARCHIVE/vz/$1/$2
[ $# -ne 2 ] && echo 'Input HOSTNAME and VEID as parameters...' && exit 1
mkdir -p "$DESTINATION"
if [ -f "$DESTINATION/root_$2.tar.gz" ]
then
echo "WARNING ! The destination archive exists... Remove it manually."
exit 3
fi
ssh $SERVER "tar -czf /tmp/root_$2.tar.gz -C /var/lib/vz/private/ $2" || exit 2
scp $SERVER:/tmp/root_$2.tar.gz "$DESTINATION" && ssh $SERVER "rm -f /tmp/root_$2.tar.gz"
scp $SERVER:/etc/vz/conf/$2.conf "$DESTINATION" && ssh $SERVER "rm -f /etc/vz/conf/$2.conf"
scp $SERVER:/etc/vz/conf/$2.mount "$DESTINATION" && ssh $SERVER "rm -f /etc/vz/conf/$2.mount"
scp $SERVER:/etc/vz/conf/$2.umount "$DESTINATION" && ssh $SERVER "rm -f /etc/vz/conf/$2.umount"
#!/bin/bash
DESTINATION=/var/ftp/pvt/Etersoft/ARCHIVE/vz/cellar
mkdir -p "$DESTINATION"
[ $# -eq 0 ] && echo 'Input VEID as parameter...' && exit 1
tar -czf root_$1.tar.gz -C /var/lib/vz/private/ $1 || exit 2
mkdir "$DESTINATION"/$1
mv -v root_$1.tar.gz "$DESTINATION"/$1
mv -v /etc/vz/conf/$1.conf "$DESTINATION"/$1/
mv -v /etc/vz/conf/$1.mount "$DESTINATION"/$1/
mv -v /etc/vz/conf/$1.umount "$DESTINATION"/$1/
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment