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

首頁 > 網站 > 建站經驗 > 正文

在Linux系統下一鍵重新安裝WordPress的腳本示例

2019-11-02 14:08:31
字體:
來源:轉載
供稿:網友

網站可能時不時的要遷移,或者誤操作,數據庫沒了,所以,我為了省時間,寫了個wordpress一鍵重新安裝的腳本。

我這只是寫個大概的。大家可以根據自己的需要修改腳本。

使用條件:

我這個腳本主要用在網站遷移的情況下,完全重新安裝時候用的。也就是說,我這個操作只導入數據庫等操作。那些wordpress的主題和插件等文件我并沒有用在下面的腳本,需要的話,你可以自己改(下面會提到)。

準備以下文件:

    原來wordpress的配置文件wp-config.php     原來的wordpress數據庫備份文件     系統安裝了wget(大部分默認安裝了)
#!bin/sh#vps wordpress一鍵重新安裝腳本#global settingUSERNAME="root"  #數據庫用戶名PASSWORD="ksharpdabu.info"  #數據庫密碼DBNAME="wordpress"     #要導入的數據庫名BACKUPSQL="/home/ksharpdabu.sql"      #備份的sql文件絕對路徑OLD_WP-CONFIG="/home/wp-config.php"  #以前保存到wp-config.php文件的絕對路徑#setting end!!WEBROOT="/home/wwwroot" #網站根目錄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()     #這一段的代碼其實的功能就是讓用戶輸入任意鍵以繼續執行腳本,是常用的代碼段  {  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}" #創建名為wordpress的數據庫,如果不存在http://www.dabu.info/?p=4329wget -c http:#cn.wordpress.org/wordpress-3.7.1-zh_CN.zip  #下載wordpress網站程序unzip wordpress-3.7.1-zh_CN.zip  #解壓wordpress程序cd wordpress  #切換到解壓后的wordpress目錄cp ./*  ${WEBROOT}  #將網站程序復制到網站根目錄/cp ${OLD_WP-CONFIG} ${WEBROOT}   #將原先的wordpress的配置文件wp-config.php放到網站根目錄mysql -u${USERNAME} -p${PASSWORD} ${DBNAME} <${BACKUPSQL}   #導入你備份的數據庫到wordpress數據庫里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"  #數據庫用戶名PASSWORD="ksharpdabu.info"  #數據庫密碼 DBNAME="wordpress"     #要導入的數據庫名BACKUPSQL="/home/ksharpdabu.sql"      #備份的sql文件絕對路徑 OLD_WP-CONFIG="/home/wp-config.php"  #以前保存到wp-config.php文件的絕對路徑#setting end!! WEBROOT="/home/wwwroot" #網站根目錄http://www.dabu.info/?p=4329 echo "###################################################################/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()     #這一段的代碼其實的功能就是讓用戶輸入任意鍵以繼續執行腳本,是常用的代碼段  {  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}" #創建名為wordpress的數據庫,如果不存在http://www.dabu.info/?p=4329 wget -c http:#cn.wordpress.org/wordpress-3.7.1-zh_CN.zip  #下載wordpress網站程序unzip wordpress-3.7.1-zh_CN.zip  #解壓wordpress程序cd wordpress  #切換到解壓后的wordpress目錄cp ./*  ${WEBROOT}  #將網站程序復制到網站根目錄/cp ${OLD_WP-CONFIG} ${WEBROOT}   #將原先的wordpress的配置文件wp-config.php放到網站根目錄mysql -u${USERNAME} -p${PASSWORD} ${DBNAME} <${BACKUPSQL}   #導入你備份的數據庫到wordpress數據庫里 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"
發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 枣阳市| 荃湾区| 远安县| 谷城县| 个旧市| 阳泉市| 巴林右旗| 河北区| 志丹县| 翼城县| 凤阳县| 台前县| 邢台县| 平江县| 东兴市| 会泽县| 湖北省| 梓潼县| 宁化县| 石景山区| 托克逊县| 环江| 惠州市| 济南市| 定西市| 靖江市| 内江市| 弥渡县| 陇川县| 剑阁县| 潮州市| 增城市| 新丰县| 永和县| 都匀市| 梓潼县| 天柱县| 全州县| 台山市| 麻城市| 永新县|