国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 系統(tǒng) > Linux > 正文

在Linux系統(tǒng)下一鍵重新安裝WordPress的腳本示例

2020-03-22 19:43:55
字體:
供稿:網(wǎng)友
網(wǎng)站可能時(shí)不時(shí)的要遷移,或者誤操作,數(shù)據(jù)庫沒了,所以,我為了省時(shí)間,寫了個(gè)wordpress一鍵重新安裝的腳本。我這只是寫個(gè)大概的。大家可以根據(jù)自己的需要修改腳本。使用條件:我這個(gè)腳本主要用在網(wǎng)站遷移的情況下,完全重新安裝時(shí)候用的。也就是說,我這個(gè)操作只導(dǎo)入數(shù)據(jù)庫等操作。那些wordpress的主題和插件等文件我并沒有用在下面的腳本,需要的話,你可以自己改(下面會提到)。準(zhǔn)備以下文件: 原來wordpress的配置文件wp-config.php 原來的wordpress數(shù)據(jù)庫備份文件 系統(tǒng)安裝了wget(大部分默認(rèn)安裝了)

DBNAME="wordpress" #要導(dǎo)入的數(shù)據(jù)庫名BACKUPSQL="/home/ksharpdabu.sql" #備份的sql文件絕對路徑OLD_WP-CONFIG="/home/wp-config.php" #以前保存到wp-config.php文件的絕對路徑#setting end?。EBROOT="/home/wwwroot" #網(wǎng)站根目錄http://www.dabu.info/ p=4329echo "###################################################################/n"echo "please backup your website data when you run this shell script!!!!/n"echo "please backup your website data when you run this shell script!!!!/n"echo "please backup your website data when you run this shell script!!!!/n"echo "###################################################################/n" get_char() #這一段的代碼其實(shí)的功能就是讓用戶輸入任意鍵以繼續(xù)執(zhí)行腳本,是常用的代碼段 SAVEDSTTY=`stty -g` stty -echo stty cbreak dd if=/dev/tty bs=1 count=1 2 /dev/null stty -raw stty echo stty $SAVEDSTTY echo "" echo "Press any key to start..." char=`get_char`create_db="create database IF NOT EXISTS ${DBNAME}"mysql -u${USERNAME} -p${PASSWORD} -e "${create_db}" #創(chuàng)建名為wordpress的數(shù)據(jù)庫,如果不存在http://www.dabu.info/ p=4329wget -c http:#cn.wordpress.org/wordpress-3.7.1-zh_CN.zip #下載wordpress網(wǎng)站程序unzip wordpress-3.7.1-zh_CN.zip #解壓wordpress程序cd wordpress #切換到解壓后的wordpress目錄cp ./* ${WEBROOT} #將網(wǎng)站程序復(fù)制到網(wǎng)站根目錄/cp ${OLD_WP-CONFIG} ${WEBROOT} #將原先的wordpress的配置文件wp-config.php放到網(wǎng)站根目錄mysql -u${USERNAME} -p${PASSWORD} ${DBNAME} ${BACKUPSQL} #導(dǎo)入你備份的數(shù)據(jù)庫到wordpress數(shù)據(jù)庫里echo "###################################################################/n"echo "please view you blog to check the success or failure./n"echo "view my blog:http://www.dabu.info/ if you have question!!/n"echo "###################################################################/n"#!bin/sh#vps wordpress一鍵重新安裝腳本#global settingUSERNAME="root" #數(shù)據(jù)庫用戶名PASSWORD="ksharpdabu.info" #數(shù)據(jù)庫密碼DBNAME="wordpress" #要導(dǎo)入的數(shù)據(jù)庫名BACKUPSQL="/home/ksharpdabu.sql" #備份的sql文件絕對路徑OLD_WP-CONFIG="/home/wp-config.php" #以前保存到wp-config.php文件的絕對路徑#setting end??!WEBROOT="/home/wwwroot" #網(wǎng)站根目錄http://www.dabu.info/ p=4329echo "###################################################################/n"echo "please backup your website data when you run this shell script!!!!/n"echo "please backup your website data when you run this shell script!!!!/n"echo "please backup your website data when you run this shell script!!!!/n"echo "###################################################################/n" get_char() #這一段的代碼其實(shí)的功能就是讓用戶輸入任意鍵以繼續(xù)執(zhí)行腳本,是常用的代碼段 SAVEDSTTY=`stty -g` stty -echo stty cbreak dd if=/dev/tty bs=1 count=1 2 /dev/null stty -raw stty echo stty $SAVEDSTTY echo "" echo "Press any key to start..." char=`get_char`create_db="create database IF NOT EXISTS ${DBNAME}"mysql -u${USERNAME} -p${PASSWORD} -e "${create_db}" #創(chuàng)建名為wordpress的數(shù)據(jù)庫,如果不存在http://www.dabu.info/ p=4329wget -c http:#cn.wordpress.org/wordpress-3.7.1-zh_CN.zip #下載wordpress網(wǎng)站程序unzip wordpress-3.7.1-zh_CN.zip #解壓wordpress程序cd wordpress #切換到解壓后的wordpress目錄cp ./* ${WEBROOT} #將網(wǎng)站程序復(fù)制到網(wǎng)站根目錄/cp ${OLD_WP-CONFIG} ${WEBROOT} #將原先的wordpress的配置文件wp-config.php放到網(wǎng)站根目錄mysql -u${USERNAME} -p${PASSWORD} ${DBNAME} ${BACKUPSQL} #導(dǎo)入你備份的數(shù)據(jù)庫到wordpress數(shù)據(jù)庫里echo "###################################################################/n"echo "please view you blog to check the success or failure./n"echo "view my blog:http://www.dabu.info/ if you have question!!/n"echo "###################################################################/n"Ps:根據(jù)需要修改腳本情況1.如果你不但備份了數(shù)據(jù)庫,還備份了網(wǎng)站的插件等文件,那么,你就直接將:
wget -c http:#cn.wordpress.org/wordpress-3.7.1-zh_CN.zip #下載wordpress網(wǎng)站程序unzip wordpress-3.7.1-zh_CN.zip #解壓wordpress程序cd wordpress #切換到解壓后的wordpress目錄cp ./* /home/wwwroot/ #將網(wǎng)站程序復(fù)制到網(wǎng)站根目錄/cp ${OLD_WP-CONFIG} ${WEBROOT}wget -c http:#cn.wordpress.org/wordpress-3.7.1-zh_CN.zip #下載wordpress網(wǎng)站程序unzip wordpress-3.7.1-zh_CN.zip #解壓wordpress程序cd wordpress #切換到解壓后的wordpress目錄cp ./* /home/wwwroot/ #將網(wǎng)站程序復(fù)制到網(wǎng)站根目錄/cp ${OLD_WP-CONFIG} ${WEBROOT}刪除,換成將網(wǎng)站所有備份文件的解壓復(fù)制命令就可以了。假設(shè)我整個(gè)我備份了/wwwroot目錄為all.tar.gz那么就寫成:tar -zvxf all.tar.gz /home2.如果僅僅是重新安裝那么你就要添加一個(gè)刪除原先wordpress數(shù)據(jù)庫或表的命令:drop databasePHP教程

鄭重聲明:本文版權(quán)歸原作者所有,轉(zhuǎn)載文章僅為傳播更多信息之目的,如作者信息標(biāo)記有誤,請第一時(shí)間聯(lián)系我們修改或刪除,多謝。

發(fā)表評論 共有條評論
用戶名: 密碼:
驗(yàn)證碼: 匿名發(fā)表
主站蜘蛛池模板: 绥江县| 二手房| 永寿县| 开封市| 雅安市| 莒南县| 泽普县| 温宿县| 富蕴县| 航空| 鱼台县| 廊坊市| 屏东市| 崇文区| 海晏县| 长泰县| 翼城县| 凤台县| 普兰县| 舒城县| 石泉县| 奇台县| 新巴尔虎左旗| 周口市| 吴桥县| 台中市| 邯郸市| 广南县| 南郑县| 腾冲县| 新余市| 兴城市| 淮安市| 石景山区| 湾仔区| 忻城县| 富民县| 唐山市| 柞水县| 龙川县| 嘉鱼县|