2009年9月3日木曜日

[Shell] いろいろバックアップ OSX用シェルスクリプト

ファイルが消えても良いようにバックアプスクリプト書いた。

ただし、このやり方が正解なのかは不明・・・。

とりあえず暇ができたら検証してみるとしよう。

#!/bin/sh

##
## Path
##
HOMEPATH="/Users/hoge/"
DROPBOXPATH="/Users/hoge/Dropbox/Backup/"
ONETDISKPATH="/Volumes/BackUp1TB/BackUp/"

##
## emacs backup to Dropbox
##
echo "BackUp [.emacs & .emacs.d] by cp -rp"

if [ -d ${DROPBOXPATH}emacs ]
 then
  echo ${DROPBOXPATH}emacs is created......
  cp -p ${HOMEPATH}.emacs ${DROPBOXPATH}emacs/
  cp -rp ${HOMEPATH}.emacs.d ${DROPBOXPATH}emacs/.emacs.d
 else
  echo ${DROPBOXPATH}emacs is not created......create!
  mkdir ${DROPBOXPATH}emacs
  cp -p ${HOMEPATH}.emacs ${DROPBOXPATH}emacs/
  cp -rp ${HOMEPATH}.emacs.d ${DROPBOXPATH}emacs/.emacs.d
fi

echo "......backup done"

##
## picture backup to 1TB HDD
##
echo "BackUp [Picture Directory] by rsync"
rsync -av --delete ${HOMEPATH}"Pictures/Picture" ${ONETDISKPATH}

##
## Application Support backup to Dropbox
##
echo "Back up [Application Support] by rsync"
rsync -av --delete ${HOMEPATH}"Library/Application Support" ${DROPBOXPATH}
rsync -av --delete ${HOMEPATH}"Library/Application Support" ${ONETDISKPATH}

##
## Application to 1TB HDD
##
echo "Back up [Application] by rsync"
rsync -av --delete "/Applications/Apps" ${ONETDISKPATH}

echo "....All backUp done"

0 件のコメント:

[Photo] 神苑ぼたん庭園

鶴岡八幡宮の神苑ぼたん庭園にて