服务器需要扩容,如何停止宝塔的所有服务?

教程开始
1:新建一个shell脚本执行以下代码
或者进面板 把以下代码丢到计划任务里的shell脚本执行

#!/bin/bash
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin
export PATH
stop_service(){
        /etc/init.d/bt stop
        if [ -f "/etc/init.d/nginx" ]; then
                /etc/init.d/nginx stop > /dev/null 2>&1
        fi
        if [ -f "/etc/init.d/httpd" ]; then
                /etc/init.d/httpd stop > /dev/null 2>&1
        fi
        if [ -f "/etc/init.d/mysqld" ]; then
                /etc/init.d/mysqld stop > /dev/null 2>&1
        fi
        if [ -f "/etc/init.d/pure-ftpd" ]; then
                /etc/init.d/pure-ftpd stop > /dev/null 2>&1
        fi
        if [ -f "/etc/init.d/tomcat" ]; then
                /etc/init.d/tomcat stop > /dev/null 2>&1
        fi
        if [ -f "/etc/init.d/redis" ]; then
                /etc/init.d/redis stop > /dev/null 2>&1
        fi
        if [ -f "/etc/init.d/memcached" ]; then
                /etc/init.d/memcached stop > /dev/null 2>&1
        fi
        if [ -f "/www/server/panel/data/502Task.pl" ]; then
                rm -f /www/server/panel/data/502Task.pl
                if [ -f "/etc/init.d/php-fpm-52" ]; then
                        /etc/init.d/php-fpm-52 stop > /dev/null 2>&1
                fi
                if [ -f "/etc/init.d/php-fpm-53" ]; then
                        /etc/init.d/php-fpm-53 stop > /dev/null 2>&1
                fi
                if [ -f "/etc/init.d/php-fpm-54" ]; then
                        /etc/init.d/php-fpm-54 stop > /dev/null 2>&1
                fi
                if [ -f "/etc/init.d/php-fpm-55" ]; then
                        /etc/init.d/php-fpm-55 stop > /dev/null 2>&1
                fi
                if [ -f "/etc/init.d/php-fpm-56" ]; then
                        /etc/init.d/php-fpm-56 stop > /dev/null 2>&1
                fi
                if [ -f "/etc/init.d/php-fpm-70" ]; then
                        /etc/init.d/php-fpm-70 stop > /dev/null 2>&1
                fi
                if [ -f "/etc/init.d/php-fpm-71" ]; then
                        /etc/init.d/php-fpm-71 stop > /dev/null 2>&1
                fi
        fi
        swapoff /www/swap
}
stop_service

2:执行完后扩容好磁盘后重新挂载上去后执行以下两条命令

swapon /www/swap
echo "True" > /www/server/panel/data/502Task.pl

3:最后别忘了启动宝塔服务哦

/etc/init.d/bt start
  • 9
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值