Commit 2dad3ce9 authored by Kai Lorenz's avatar Kai Lorenz

fixed commit error

parent 41faaac6
#!/usr/bin/env bash
# Utility Tool to archive a user account on a standard webis machine
# based on https://www.cyberciti.biz/faq/howto-move-migrate-user-accounts-old-to-new-server/
# Last update 24.02.2019
ls /home/
echo "Please enter the target username"
read varTargerUser
read -p "Please confirm, "$varTargerUser" is your target? Y/N " -n 1 -r
echo # (optional) move to a new line
if [[ $REPLY =~ ^[Yy]$ ]]
then
varArchiveName=$({ date +%Y; echo -; hostname; echo -; echo $varTargerUser; } | sed ':a;N;s/\n/ /;ba' | tr -d '[:space:]')
sudo mkdir /move
sudo apt-get autoremove -y
echo "creating tar from home"
sudo tar --exclude='/home/$varTargerUser/.local/share/Trash/' --exclude='/home/$varTargerUser/.cache/mozilla' --exclude='/home/$varTargerUser/.wine' --exclude='/home/$varTargerUser/.cache/google-chrome' --exclude='/home/$varTargerUser/.cache/pip' --exclude='/home/$varTargerUser/.cache/thumbnails' -zcvpf /move/$varArchiveName.tar.gz /home/$varTargerUser
sudo mv -uv /move/* /mnt/nfs/webis20/code-in-archive/account-graveyard
fi
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