Last active
February 20, 2017 13:23
-
-
Save Equim-chan/3ea978c0be9f2637298c2a2d01696f22 to your computer and use it in GitHub Desktop.
Personal script for backup/sync
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/sh | |
echo "******************************" | |
echo "* Equim's onekey-backup tool *" | |
echo "******************************" | |
read -p "接下来要对全盘进行物理备份,是否继续? [y\N] " | |
if [ "$REPLY"x == "yx" ]; then | |
TODAY=$(date +%y%m%d) | |
UPLOADER="/home/Equim/tools/bpcs_uploader/bpcs_uploader.php" | |
cd /bak | |
echo "正在备份,请耐心等待..." | |
tar cvpjf /bak/[${TODAY}]${HOSTNAME}.tar.bz2 \ | |
--exclude=/proc \ | |
--exclude=/lost+found \ | |
--exclude=/bak \ | |
--exclude=/mnt \ | |
--exclude=/sys \ | |
--exclude=/media \ | |
/ \ | |
> /bak/[${TODAY}]${HOSTNAME}.log | |
chmod 444 /bak/[${TODAY}]${HOSTNAME}.tar.bz2 | |
chmod 444 /bak/[${TODAY}]${HOSTNAME}.log | |
echo "备份已完成,准备上传到百度云..." | |
su -l Equim -c "${UPLOADER} upload /bak/[${TODAY}]${HOSTNAME}.log /${HOSTNAME}/bak/[${TODAY}]${HOSTNAME}.log" | |
su -l Equim -c "${UPLOADER} upload /bak/[${TODAY}]${HOSTNAME}.tar.bz2 /${HOSTNAME}/bak/[${TODAY}]${HOSTNAME}.tar.bz2" | |
echo "已完成备份与同步" | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment