#!/bin/sh # 使用说明,用来提示输入参数 usage() { echo "Usage: sh 执行脚本.sh [port|base|modules|stop|rm]" exit 1 } # 开启所需端口 port(){ firewall-cmd --add-port=80/tcp --permanent firewall-cmd --add-port=8080/tcp --permanent firewall-cmd --add-port=8848/tcp --permanent firewall-cmd --add-port=9848/tcp --permanent firewall-cmd --add-port=9849/tcp --permanent firewall-cmd --add-port=6379/tcp --permanent firewall-cmd --add-port=3306/tcp --permanent firewall-cmd --add-port=9100/tcp --permanent firewall-cmd --add-port=9200/tcp --permanent firewall-cmd --add-port=9201/tcp --permanent firewall-cmd --add-port=9202/tcp --permanent firewall-cmd --add-port=9203/tcp --permanent firewall-cmd --add-port=9300/tcp --permanent service firewalld restart } # 启动基础环境(必须) base(){ docker-compose up -d ruoyi-mysql ruoyi-redis ruoyi-nacos } # 启动程序模块(必须) modules(){ docker-compose up -d ruoyi-ui ruoyi-gateway ruoyi-system } # 关闭所有环境/模块 stop(){ docker-compose stop } # 删除所有环境/模块 rm(){ docker-compose rm } rm_data(){ rm -rf mysql/data rm -rf nacos/logs rm -rf redis/data rm -rf nginx/logs rm -rf ruoyi/gateway/jar/gateway.jar rm -rf ruoyi/modules/file/jar/service-file.jar rm -rf ruoyi/modules/gen/jar/service-gen.jar rm -rf ruoyi/modules/job/jar/service-job.jar rm -rf ruoyi/modules/system/jar/service-system-biz.jar rm -rf ruoyi/visual/monitor/jar/monitor.jar } # 根据输入参数,选择执行对应方法,不输入则执行使用说明 case "$1" in "port") port ;; "base") base ;; "modules") modules ;; "stop") stop ;; "rm") rm ;; "rm_data") rm_data ;; *) usage ;; esac