wdcp的環境搭建shell指令碼分析--install.sh

來源:互聯網
上載者:User

標籤:shell

#!/bin/bash####定義screen的名字,下面安裝會用screen這個命令SCREEN_NAME="lanmp"#根據$UID判斷使用者是否為root,必須root才能執行if [ $UID != 0 ]; then    echo "You must be root to run the install script."    exitfi#根據命令列參數判斷,參數為un或者uninstall時,停止服務,刪除檔案,卸載掉整個WDCP服務if [ "$1" == "un" -o "$1" == "uninstall" ]; then    service httpd stop    service nginxd stop    service mysqld stop    service pureftpd stop    service wdapache stop    #建立檔案備份目錄    mkdir /www/backup    bf=$(date +%Y%m%d)    #打包資料庫檔案    tar zcf /www/backup/mysqlbk_$bf.tar.gz /www/wdlinux/mysql/var    rm -fr /www/wdlinux    rm -f /tmp/*_ins.txt    reboot    exitfi#對當前系統中是否存在screen進程進行判斷,如果已經存在lanmp的screen進程,則提示,並退出if type -p screen >/dev/null && screen -ls |grep -q "[0-9].$SCREEN_NAME"; then    echo "Seems another lanmp install session is taken place."    echo "Rejoin this session plz type: ‘screen -r $SCREEN_NAME‘."    exit 1fi#根據/etc/issue判斷當前系統類別型,然後根據type的返回結果,判斷是否安裝screen,沒有安裝,就進行安裝if grep -qi ‘debian\|ubuntu‘ /etc/issue; then    type -p screen >/dev/null || apt-get -y install screenelse    type -p screen >/dev/null || yum -y install screenfi


本文出自 “實踐就是真道理” 部落格,謝絕轉載!

wdcp的環境搭建shell指令碼分析--install.sh

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.