75 lines
1.3 KiB
Bash
Executable File
75 lines
1.3 KiB
Bash
Executable File
#!/bin/bash
|
||
|
||
|
||
|
||
newTerminal() {
|
||
osascript 2>/dev/null <<EOF
|
||
tell application "System Events"
|
||
tell process "Terminal" to keystroke "t" using command down
|
||
end
|
||
tell application "Terminal"
|
||
activate
|
||
do script with command "cd \"$PWD\"; $*" in window 1
|
||
end tell
|
||
EOF
|
||
}
|
||
|
||
fastapi(){
|
||
newTerminal "echo 正在启动 FastApi,请稍等... && $PWD/venv/bin/python -B main.py"
|
||
}
|
||
|
||
celery(){
|
||
echo "echo 正在启动 Celery,请稍等... && celery -A src.celery.main.app worker -l info -P eventlet"
|
||
}
|
||
|
||
flower(){
|
||
echo "echo 正在启动 Flower,请稍等... && celery --broker=redis://:lb714500@127.0.0.1:6379/0 flower --port=5551"
|
||
}
|
||
|
||
redis(){
|
||
echo "echo 正在启动 Redis Server,请稍等... && cd C:\Program Files\Redis && redis-server.exe redis.windows.conf"
|
||
}
|
||
|
||
all(){
|
||
redis
|
||
fastapi
|
||
celery
|
||
flower
|
||
}
|
||
|
||
name='0'
|
||
menu() {
|
||
echo
|
||
echo AI爬虫 批处理启动菜单
|
||
echo
|
||
echo 1: 启动 FastApi
|
||
echo 2: 启动 Celery
|
||
echo 3: 启动 Flower WebUi
|
||
echo 4: 启动 Redis Server
|
||
echo 5: 全部 启动
|
||
echo
|
||
read -p "请输入你的选择:" name
|
||
}
|
||
|
||
menu
|
||
|
||
if [ $name == "1" ]
|
||
then
|
||
fastapi
|
||
elif [ $name == "2" ]
|
||
then
|
||
celery
|
||
elif [ $name == "3" ]
|
||
then
|
||
flower
|
||
elif [ $name == "4" ]
|
||
then
|
||
redis
|
||
elif [ $name == "5" ]
|
||
then
|
||
all
|
||
else
|
||
echo "没有符合的条件"
|
||
fi
|
||
|