在 Godaddy 申請域名 (domain) ,都會免費得到一個 10G 容量 (300G 流量)的網存 (webhosting)。因為這個網存是帶有 godaddy 的廣告,所以使用它的人不多。坦白說,就算是付費的網存,godaddy 也不是一個很好的供應商,但利用這個 10G 的免費網存則是一個 cost effective 的 offsite backup solution
1. 登入 godaddy My Products 頁面,選 hosting
2. Activate Your Free Account,再跟步驟,就有一個 10G 容量的免費網存
3. 跟著你便得到 ip address ,hosting path 等的資料
4. 首先你要設定是 DNS
www.mywebsite.com 的 ip address 就是你真正 website hosting 的網存
設定一個 godaddy.mywebsite.com ,ip address 設定為上述 Goddaddy free hosting 設定的 "Server IP Address"
5. 在你真正的網存供應商便可以設定自動 backup script。假設除了空間外也有 mysql 的 database.
godaddy_backup.sh #!/bin/bash /usr/local/mysql/bin/mysqldump -uuser -ppassword myweb > /home/wwwroot/www.hkeasytech.com/$(date +%Y%m%d)-hkeasytech.sql cd /home/wwwroot/ #tar -zcvf $(date +%Y%m%d)-hkeasytech.com.tar.gz ./* zip -r -P "mysecret" $(date +%Y%m%d)-hkeasytech.zip www.hkeasytech.com/ echo "open godaddy.hkeasytech.com user username password cd mybackup bin prompt off mput $(date +%Y%m%d)-hkeasytech.zip printf "\n" close bye"|ftp -i -n rm -rf www.hkeasytech.com/$(date +%Y%m%d)-hkeasytech.sql $(date +%Y%m%d)-hkeasytech.zip
這個 script 會加密整個 zip file 才上傳到 godaddy free hosting site.
6. 在你的 hosting 設定 cronjob,每天上傳 backup。因為每個網存公司都有不同設定方法,請向你的供應商查詢。
7. 這個 script 是會每天上傳一個 full backup 到 godaddy 網存內 mybackup 的目錄。愈積會愈多,故也要做一個 backup retention。這需要在 godaddy 也設定一個 cronjob 運行一個 rentention script.
retention.sh find $HOME/html/mybackup -ctime +3 -exec rm {} \;
這會清除 mybackup 目錄下三日前的檔案
8. 再在 godaddy 的 hosting control panel 設定這個 script 的 crontjob