perf(linux): 支持从任意路径执行启动脚本

- 使用 readlink 定位脚本真实路径
- 启动时自动切换到项目目录
This commit is contained in:
xiongxiaoyang
2025-09-29 17:30:12 +08:00
parent 0564871093
commit 1ad240c7f9
3 changed files with 14 additions and 6 deletions

View File

@@ -5,9 +5,12 @@ JAR_NAME=$APP_NAME\.jar
PID=$APP_NAME\.pid
#使用说明,用来提示输入参数
SCRIPT_DIR=$(dirname "$(readlink -f "$0")")
cd "$SCRIPT_DIR"/.. || exit 1
# 使用说明
usage() {
echo "Usage: ./novel-admin.sh [start|stop|restart|status]"
echo "Usage: $0 [start|stop|restart|status]"
exit 1
}

View File

@@ -5,9 +5,12 @@ JAR_NAME=$APP_NAME\.jar
PID=$APP_NAME\.pid
#使用说明,用来提示输入参数
SCRIPT_DIR=$(dirname "$(readlink -f "$0")")
cd "$SCRIPT_DIR"/.. || exit 1
# 使用说明
usage() {
echo "Usage: ./novel-crawl.sh [start|stop|restart|status]"
echo "Usage: $0 [start|stop|restart|status]"
exit 1
}

View File

@@ -4,10 +4,12 @@ JAR_NAME=$APP_NAME\.jar
#PID 代表是PID文件
PID=$APP_NAME\.pid
SCRIPT_DIR=$(dirname "$(readlink -f "$0")")
cd "$SCRIPT_DIR"/.. || exit 1
#使用说明,用来提示输入参数
# 使用说明
usage() {
echo "Usage: ./novel-front.sh [start|stop|restart|status]"
echo "Usage: $0 [start|stop|restart|status]"
exit 1
}