#!/sbin/openrc-run # OpenDance Studio Web 管理服务端 —— OpenRC 服务脚本 # # 安装位置:/etc/init.d/opendance-api # rc-update add opendance-api default # rc-service opendance-api start name="opendance-api" description="OpenDance Studio Web 管理服务端" command="__NODE_BIN__" command_args="__APP_DIR__/web-server/dist/main.js" command_background="yes" pidfile="/run/opendance-api.pid" directory="__APP_DIR__/web-server" command_user="__SERVICE_USER__:__SERVICE_USER__" output_log="/var/log/opendance-api.log" error_log="/var/log/opendance-api.log" supervisor="supervise-daemon" depend() { need net after firewall use dns logger } start_pre() { # 载入部署环境变量(OpenRC 没有 EnvironmentFile,用 start_pre 导出) if [ -f "__APP_DIR__/deploy/.env" ]; then set -a # shellcheck disable=SC1091 . "__APP_DIR__/deploy/.env" set +a fi checkpath --directory --owner __SERVICE_USER__:__SERVICE_USER__ /var/log }