case防火墙
#!/bin/bash
#function:演示
#author:tommy 20211014
case "$1" in
start)
echo -n "正在启动防火墙服务......"
if
systemctl "$1" firewalld.service &>/dev/null
then
echo "ok"
fi
;;
stop)
echo -n "正在停止防火墙服务......"
systemctl "$1" firewalld.service
echo "ok"
;;
status)
if
systemctl "$1" firewalld.service &>/dev/null
then
echo "防火墙服务已启动"
else
echo "防火墙服务已经停止"
fi
;;
restart)
systemctl "$1" firewalld.service
;;
*)
echo "用法: sh $0 {start|stop|status|restart}"
esac
#function:演示
#author:tommy 20211014
case "$1" in
start)
echo -n "正在启动防火墙服务......"
if
systemctl "$1" firewalld.service &>/dev/null
then
echo "ok"
fi
;;
stop)
echo -n "正在停止防火墙服务......"
systemctl "$1" firewalld.service
echo "ok"
;;
status)
if
systemctl "$1" firewalld.service &>/dev/null
then
echo "防火墙服务已启动"
else
echo "防火墙服务已经停止"
fi
;;
restart)
systemctl "$1" firewalld.service
;;
*)
echo "用法: sh $0 {start|stop|status|restart}"
esac
上一技术:redis一键部署脚本-王总分享
下一技术:nginx一键部署脚本