Commit ce74d0ac authored by Vitaly Lipatov's avatar Vitaly Lipatov

archive_site: add -f for force, skip tarball if site dir does not exists, use zpaq

parent 1eec9d1a
#!/bin/sh
# remove site to archive:
# $ archive_site.sh /path/to/site
if [ "$1" = "-f" ] ; then
shift
FORCE=1
fi
test "$1" || exit 1
SITEPATH="$(realpath $1)"
......@@ -14,13 +20,18 @@ IPHOST=91.232.225.9
if [ -n "$IP" ] && [ "$IP" = "$IPHOST" ] ; then
echo "$DOMAINNAME still on $IPHOST IP ($IP really)"
exit
[ -n "$FORCE" ] || exit
fi
test -n "$USERNAME" || exit
test -d "/home/$USERNAME" || exit
test -n "$DOMAINNAME" || exit
try_rm_user()
{
rmdir "/home/$USERNAME/www" && rm -vrf /home/$USERNAME/ && userdel $USERNAME
}
cd $(dirname $0) || exit
. ./config
......@@ -40,11 +51,11 @@ echo "$conffile"
mkdir -p /home/archive
mv $conffile /home/archive/$conffile
cd "$SITEPATH" || exit
erc a /home/archive/$DOMAINNAME.tar.xz . || exit
cd "$SITEPATH" || { try_rm_user ; exit ; }
erc add /home/archive/$DOMAINNAME.zpaq . || exit
rm -vrf "$SITEPATH"
rmdir "/home/$USERNAME/www" && rm -vrf /home/$USERNAME/ && userdel $USERNAME
try_rm_user
cd /
serv httpd2 reload
......
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