补充脚本文件

This commit is contained in:
zhaojun
2025-04-03 22:54:42 +08:00
parent 6da72845e4
commit f5b6f8da4e
8 changed files with 64 additions and 3 deletions

4
.gitignore vendored
View File

@@ -36,6 +36,4 @@ build/
/.mvn/wrapper/
/mvnw
/mvnw.cmd
/result/
/.package/**
/.package**
/result/

2
.package/script/log.sh Normal file
View File

@@ -0,0 +1,2 @@
#!/bin/bash
tail -fn100 ~/.zfile-v4/logs/zfile.log

View File

@@ -0,0 +1,6 @@
#!/bin/bash
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
$DIR/stop.sh
$DIR/start.sh

22
.package/script/start.sh Normal file
View File

@@ -0,0 +1,22 @@
#!/bin/bash
# 检测是否已启动
pid=`ps -ef | grep -n zfile | grep -v grep | grep -v launch | grep -v .sh | awk '{print $2}'`
if [ -n "${pid}" ]
then
echo "已运行在 pid${pid},无需重复启动!"
exit 0
fi
# 获取当前脚本所在路径
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
ZFILE_DIR=$(dirname "$DIR")
# 启动 zfile
nohup $ZFILE_DIR/zfile/zfile --spring.config.location=$ZFILE_DIR/application.properties --spring.web.resources.static-locations=file:$ZFILE_DIR/static/ >/dev/null 2>&1 &
echo '启动中...'
sleep 3s
# 输出 pid
pid=`ps -ef | grep -n zfile | grep -v grep | grep -v .sh | awk '{print $2}'`
echo "目前 PID 为: ${pid}"

12
.package/script/status.sh Normal file
View File

@@ -0,0 +1,12 @@
#!/bin/bash
echo "------------------ 检测状态 START --------------"
pid=`ps -ef | grep -n zfile | grep -v grep | grep -v launch | grep -v .sh | awk '{print $2}'`
if [ -z "${pid}" ]
then
echo "未运行, 无需停止!"
else
echo "运行pid${pid}"
fi
echo "------------------ 检测状态 END --------------"

14
.package/script/stop.sh Normal file
View File

@@ -0,0 +1,14 @@
#!/bin/bash
echo "------------------ 检测状态 START --------------"
pid=`ps -ef | grep -n zfile | grep -v grep | grep -v .sh | awk '{print $2}'`
if [ -z "${pid}" ]
then
echo "未运行, 无需停止!"
else
echo "运行pid${pid}"
kill -9 ${pid}
echo "已停止进程: ${pid}"
fi
echo "------------------ 检测状态 END --------------"

Binary file not shown.

View File

@@ -0,0 +1,7 @@
@echo off
if not exist %windir%\system32\cmd.exe (
"%CD%\zfile\zfile.exe"
) else (
cmd /k "%CD%\zfile\zfile.exe"
exit
)