Skip to content

Instantly share code, notes, and snippets.

@denisivan0v
Last active April 30, 2019 09:43
Show Gist options
  • Save denisivan0v/019883fce1d7053ab0b4233e905ef3c0 to your computer and use it in GitHub Desktop.
Save denisivan0v/019883fce1d7053ab0b4233e905ef3c0 to your computer and use it in GitHub Desktop.
TVP migration
# https://manpages.debian.org/testing/cifs-utils/mount.cifs.8.en.html
sudo mount.cifs //host/path/to/share /mount/path --verbose -o username=<username>,domain=<domain>,ro,vers=2.1,actimeo=600,noperm,file_mode=0777,dir_mode=0777,fsc,nobrl,nocase,noacl
# To unmount
sudo umount /mount/path
  • To start a new session
$ tmux
  • To list active sessions
$ tmux list-sessions
  • To attach to session
$ tmux attach -t <session name>
  • To deattach form the session
CTRL+b, then d
#!/bin/bash
echo "Source directory: '$1'"
echo "Target directory: '$2'"
echo "Log files directory: '$3'"
if [ ! -d $2 ]; then
mkdir -p $2;
fi
if [ ! -d $3 ]; then
mkdir -p $3;
fi
for D in `find $1 -mindepth 1 -maxdepth 1 -type d`
do
FILENAME=$(basename "${D}").tar
FILEPATH=$2/$FILENAME
LOG_FILENAME=$(basename "${D}").log
LOG_FILEPATH=$3/$LOG_FILENAME
echo "Packing and uploading directory '$D'..."
tar cv --ignore-failed-read $D 2>$LOG_FILEPATH | (pv -p --timer --rate --bytes > $FILEPATH)
if [ $? -eq 0 ]; then
echo "Directory '$D' has been successfully uploaded as '$FILEPATH'";
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment