前幾篇博客已經(jīng)相繼公開了去轉盤網(wǎng)的所有技術細節(jié),如下:
創(chuàng)新互聯(lián)公司-專業(yè)網(wǎng)站定制、快速模板網(wǎng)站建設、高性價比洪雅網(wǎng)站開發(fā)、企業(yè)建站全套包干低至880元,成熟完善的模板庫,直接使用。一站式洪雅網(wǎng)站制作公司更省心,省錢,快速模板網(wǎng)站建設找我們,業(yè)務覆蓋洪雅地區(qū)。費用合理售后完善,十多年實體公司更值得信賴。
百度網(wǎng)盤爬蟲
中文分詞算法
邀請好友注冊
js分頁部分代碼
這篇博客我將繼續(xù)公開數(shù)據(jù)庫自動備份的代碼??梢赃@么說,沒有數(shù)據(jù)庫,一切就是個蛋,沒有數(shù)據(jù)庫備份,一切還是個蛋,你可以想象數(shù)據(jù)庫備份多么重要。不會linux,不會寫shell的朋友麻煩先去補補。不過你說我牛逼,不補也能看懂,那沒問題,哈哈,廢話不說了。老規(guī)矩,上代碼:
#!/bin/bash time=$(date +"%d-%m-%Y") pre=/home/ubuntu #想放到那里麻煩自己配置下哈 if [ ! -d "$pre/data_backup/$time" ] then mkdir -p $pre/data_backup/$time echo "create $pre/data_backup/$time" else echo "exist $pre/data_backup/$time" fi if [ -d "$pre/data_backup/$time" ] then MySQLdump -h20.66.102.75 -uroot -p123456 --opt winrun user > $pre/data_backup/$time/user.sql mysqldump -h20.66.102.75 -uroot -p123456--opt winrun CategoryInfo > $pre/data_backup/$time/CategoryInfo.sql mysqldump -h20.66.102.75 -uroot -p123456 --opt winrun admin_info > $pre/data_backup/$time/admin_info.sql mysqldump -h20.66.102.75 -uroot -p123456 --opt winrun admin_loginfo > $pre/data_backup/$time/admin_loginfo.sql mysqldump -h20.66.102.75 -uroot -p123456 --opt winrun admin_notice_info > $pre/data_backup/$time/admin_notice_info.sql mysqldump -h20.66.102.75 -uroot -p123456--opt winrun advertising_info > $pre/data_backup/$time/advertising_info.sql mysqldump -h20.66.102.75 -uroot -p123456--opt winrun ajax_request_info > $pre/data_backup/$time/ajax_request_info.sql mysqldump -h20.66.102.75 -uroot -p123456 --opt winrun bt_file_info > $pre/data_backup/$time/bt_file_info.sql echo "backup finished" cd $pre/data_backup #enter dir zip -r $time.zip $time/ rm -fr $time #delete cd - echo "zip backup database finished" else echo "can not find backup file" fi
注意,我的密碼我已經(jīng)改了,這個不能告訴你們,所以喜歡copy的孩子麻煩自己該密碼。下面我教大家玩下crotab,代碼如下:
# Edit this file to introduce tasks to be run by cron. # # Each task to run has to be defined through a single line # indicating with different fields when the task will be run # and what command to run for the task # # To define the time you can provide concrete values for # minute (m), hour (h), day of month (dom), month (mon), # and day of week (dow) or use '*' in these fields (for 'any').# # Notice that tasks will be started based on the cron's system # daemon's notion of time and timezones. # # Output of the crontab jobs (including errors) is sent through # email to the user the crontab file belongs to (unless redirected). # # For example, you can run a backup of all your user accounts # at 5 a.m every week with: # 0 5 * * 1 tar -zcf /var/backups/home.tgz /home/ # # For more information see the manual pages of crontab(5) and cron(8) # # m h dom mon dow command 10 1 * * 1,3,5 /home/backup.sh >> /home/backup.log
有用的是最下面的這一句,看到?jīng)]有,備份完了還得有個log,不然誰知道備份成什么樣子了,一點都不懂crontab麻煩自己百度下,我也一時給你講不明白。
上面是備份的結果,注意,備份完了之后是壓縮包的形式,所以請你先安裝壓縮工具,apt-get install XXXX 不會的還是麻煩百度下,實在簡單成狗了。
技術在于分享,開源,去轉盤不吝嗇任何技術,歡迎關注微博或者微信,隨時交流。