Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
文鑫
/
guduo_spider
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
Commit
103b682a
...
103b682a4b4fd9c897156a09e242415c76582854
authored
2024-12-23 13:59:42 +0800
by
wenxin
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
添加启停脚本
1 parent
9d77aaa9
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
27 additions
and
0 deletions
app/start.sh
app/stop.sh
app/start.sh
0 → 100644
View file @
103b682
#!/bin/bash
# 激活 conda 环境
eval
"
$(
conda shell.bash hook
)
"
conda activate spider
# 切换到 app 目录
cd
./app
||
exit
# 后台运行 FastAPI 应用
nohup python main.py &
# 输出进程ID到文件,以便于后续停止服务时使用
echo
$!
> fastapi.pid
# 在启动之后输出pid文件中的进程ID
echo
"怕从服务启动成功:
$(
cat fastapi.pid
)
"
\ No newline at end of file
app/stop.sh
0 → 100644
View file @
103b682
#!/bin/bash
# 读取PID文件以获取进程ID
if
[
-f fastapi.pid
]
;
then
PID
=
$(
cat fastapi.pid
)
echo
"停止爬虫服务 PID->:
$PID
"
kill
-9
$PID
# 删除PID文件
rm fastapi.pid
else
echo
"未找到爬虫服务PID"
fi
echo
"爬虫服务已停止"
\ No newline at end of file
Please
register
or
sign in
to post a comment