mirror of
https://github.com/margrop/wrong-notebook.git
synced 2026-12-05 10:29:22 +08:00
- SPK 外层改为未压缩的 tar(此前用 gzip 压缩,DSM 无法识别) - 套件改为以套件用户运行(DSM 7 拒绝 run-as root 的第三方套件), 容器由 Container Manager 的 docker-project 资源创建并随套件启停 - 数据放在套件数据目录,入口改为 DSM 主菜单图标;不再声明 adminport, 避免卸载后重装报端口冲突 - 最低要求调整为 DSM 7.2.1 与 Container Manager 20.10.23-1432
45 lines
1.1 KiB
Bash
Executable File
45 lines
1.1 KiB
Bash
Executable File
#!/bin/sh
|
||
# 群晖套件服务控制。脚本以套件用户运行,不能调用 docker:
|
||
# 容器由 conf/resource 的 docker-project 资源随套件启停,这里只按服务端口报告状态。
|
||
set -eu
|
||
|
||
WN_HOST_PORT=39300
|
||
|
||
# 端口有 HTTP 响应即视为运行中(数据库迁移期间健康检查尚未就绪,也算已启动)
|
||
responding() {
|
||
curl -s -o /dev/null --max-time 5 "http://127.0.0.1:${WN_HOST_PORT}/api/health" 2>/dev/null
|
||
}
|
||
|
||
wait_responding() {
|
||
i=0
|
||
while [ "${i}" -lt 90 ]; do
|
||
if responding; then
|
||
return 0
|
||
fi
|
||
i=$((i + 1))
|
||
sleep 2
|
||
done
|
||
return 1
|
||
}
|
||
|
||
case "${1:-status}" in
|
||
start)
|
||
if ! wait_responding; then
|
||
echo "错题本容器未在预期时间内响应,请在 Container Manager 的「项目」中查看 wrong-notebook 的日志。"
|
||
exit 1
|
||
fi
|
||
;;
|
||
stop | prestart | prestop) ;;
|
||
status)
|
||
if responding; then
|
||
exit 0
|
||
fi
|
||
exit 3
|
||
;;
|
||
*)
|
||
echo "Usage: $0 {start|stop|status}" >&2
|
||
exit 1
|
||
;;
|
||
esac
|
||
exit 0
|