|
Server : Apache System : Linux iZ6xhqomji47p1Z 5.10.134-15.al8.x86_64 #1 SMP Thu Jul 20 00:44:04 CST 2023 x86_64 User : www ( 1000) PHP Version : 8.1.30 Disable Function : passthru,exec,system,putenv,chroot,chgrp,chown,shell_exec,popen,proc_open,pcntl_exec,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,imap_open,apache_setenv Directory : /www/server/site_total/scripts/ |
#!/bin/bash
# 检查是否以root权限运行
if [ "$EUID" -ne 0 ]; then
echo "请使用root权限运行此脚本"
exit 1
fi
# 设置变量
SERVICE_NAME="site_total"
SERVICE_FILE="/etc/systemd/system/${SERVICE_NAME}.service"
# 检查服务是否存在
if [ ! -f "$SERVICE_FILE" ]; then
echo "服务文件 $SERVICE_FILE 不存在,可能服务未安装"
exit 1
fi
# 停止并禁用服务
echo "停止 $SERVICE_NAME 服务..."
systemctl stop "$SERVICE_NAME"
echo "禁用 $SERVICE_NAME 服务..."
systemctl disable "$SERVICE_NAME"
# 删除服务文件
echo "删除服务文件..."
rm -f "$SERVICE_FILE"
# 重新加载systemd配置
systemctl daemon-reload
# 删除nginx配置文件
echo "删除nginx配置文件..."
rm -f /www/server/panel/vhost/nginx/extension/*/site_total.conf
# 重载nginx
echo "重载nginx..."
/www/server/nginx/sbin/nginx -s reload
echo "$SERVICE_NAME 服务已成功卸载"