#!/bin/bash### #定义screen的名字, the following installation will use screen this command screen_name= "LANMP" #根据 $UID to determine whether the user is root, must root to perform if [ $UID != 0 ]; then echo "You must be root to run the install script. " exitfi# according to the command line parameters, the parameter is un or uninstall, stop the service, delete the file, uninstall the entire WDCP service if [ "$" == "UN" -o "$" == "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# determines whether the screen process exists in the current system, prompts if a lanmp screen process already exists, and exits 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# determines the current system type based on/etc/issue and then, based on the return result of type, determines if screen is installed and installs without installation 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
This article from the "Practice is true truth" blog, declined reprint!
WDCP Environment Build shell script analysis--install.sh