Last active
March 29, 2017 00:30
-
-
Save sundy-li/a535539ed2ce15935a532822d27ab08c to your computer and use it in GitHub Desktop.
backup_data.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
## backup use ssh | |
# bash backup_data.sh /data/tmp/wx.csv wx chuxing@s1:/data/boomer/ | |
source=$1 | |
zip=$2 | |
remote=$3 | |
dir=`dirname $1` | |
name=`basename $source` | |
mkdir -p /data/backup/ | |
cd $dir | |
tar -cPzf /data/backup/${zip}.tar.gz $name | |
rsync -vlcr /data/backup/${zip}.tar.gz $remote --progress |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment