写一个关闭linux mariadb服务的脚本
#!/bin/bash #关闭Mariadb服务的脚本
#检查是否为root用户 if [ "$(whoami)" != "root" ]; then echo "请使用root用户执行此脚本" exit 1 fi
#检查Mariadb服务是否正在运行 if ! systemctl is-active mariadb >/dev/null 2>&1; then echo "Mariadb服务没有运行" exit 1 fi
#停止Mariadb服务 systemctl stop mariadb
#检查Mariadb服务是否已停止 if systemctl is-active mariadb >/dev/null 2>&1; then echo "Mariadb服务停止失败" exit 1 else echo "Mariadb服务已停止" fi
exit 0
原文地址: https://www.cveoy.top/t/topic/bw5l 著作权归作者所有。请勿转载和采集!