Skip to content

Instantly share code, notes, and snippets.

@sundy-li
Last active March 29, 2017 00:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sundy-li/a535539ed2ce15935a532822d27ab08c to your computer and use it in GitHub Desktop.
Save sundy-li/a535539ed2ce15935a532822d27ab08c to your computer and use it in GitHub Desktop.
backup_data.sh
#!/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