当前位置: 首页 > news >正文

linux startup.sh shutdown.sh (kkFileView)

linux启动脚本和关闭脚本startup.sh   shutdown.sh (kkFileView)

startup.sh


DIR_HOME=("/opt/openoffice.org3" "/opt/libreoffice" "/opt/libreoffice6.1" "/opt/libreoffice7.0" "/opt/libreoffice7.1" "/opt/libreoffice7.2" "/opt/libreoffice7.3" "/opt/libreoffice7.4" "/opt/openoffice4" "/usr/lib/openoffice" "/usr/lib/libreoffice")
FLAG=
OFFICE_HOME=
KKFILEVIEW_BIN_FOLDER=$(cd "$(dirname "$0")" || exit 1 ;pwd)
PID_FILE_NAME="kkFileView.pid"
PID_FILE="${KKFILEVIEW_BIN_FOLDER}/${PID_FILE_NAME}"
export KKFILEVIEW_BIN_FOLDER=$KKFILEVIEW_BIN_FOLDER
#
## 如pid文件不存在则自动创建
if [ ! -f ${PID_FILE_NAME} ]; thentouch "${KKFILEVIEW_BIN_FOLDER}/${PID_FILE_NAME}"
fi
## 判断当前是否有进程处于运行状态
if [ -s "${PID_FILE}" ]; thenPID=$(cat "${PID_FILE}")echo "进程已处于运行状态,进程号为:${PID}"exit 1
elsecd "$KKFILEVIEW_BIN_FOLDER" || exit 1echo "Using KKFILEVIEW_BIN_FOLDER $KKFILEVIEW_BIN_FOLDER"grep 'office\.home' ../config/application.properties | grep '!^#'if [ $? -eq 0 ]; thenecho "Using customized office.home"elsefor i in ${DIR_HOME[@]}doif [ -f "$i/program/soffice.bin" ]; thenFLAG=trueOFFICE_HOME=${i}breakfidoneif [ ! -n "${FLAG}" ]; thenecho "Installing LibreOffice"sh ./install.shelseecho "Detected office component has been installed in $OFFICE_HOME"fifi## 启动kkFileViewecho "Starting kkFileView..."nohup java -Dfile.encoding=UTF-8 -Dspring.config.location=../config/application.properties -jar kkFileView-4.2.1.jar > ../log/kkFileView.log 2>&1 &echo "Please execute ./showlog.sh to check log for more information"echo "You can get help in our official home site: https://kkview.cn"echo "If you need further help, please join our kk opensource community: https://t.zsxq.com/09ZHSXbsQ"echo "If this project is helpful to you, please star it on https://gitee.com/kekingcn/file-online-preview/stargazers"PROCESS=$(ps -ef | grep kkFileView | awk 'NR==1{print $2}')# 启动成功后将进程号写入pid文件echo "$PROCESS" > "$PID_FILE"
fi

shutdown.sh


#
KKFILEVIEW_BIN_FOLDER=$(cd "$(dirname "$0")" || exit 1 ;pwd)
PID_FILE_NAME="kkFileView.pid"
PID_FILE="${KKFILEVIEW_BIN_FOLDER}/${PID_FILE_NAME}"
export KKFILEVIEW_BIN_FOLDER=$KKFILEVIEW_BIN_FOLDER
#
## pid文件是否存在
if [ ! -e "$PID_FILE" ]; thenecho "kkFileView.pid文件不存在!"exit 1
else## 文件不为空代表程序正在运行,则循环关闭进程。if [ -s "$PID_FILE" ]; then# 读取pid文件内容,开启while循环读取每一行文本赋予给变量PID_FILE。cat "${PID_FILE}" | while read PID;do## 如已读取完毕,则退出脚本。[ -z "$PID" ] && exit 2echo "正在停止进程:${PID}..."## 正常停止进程kill -15 "${PID}" && echo "进程:${PID}停止成功!"done# 关闭所有进程后,重置pid。cat /dev/null > "$PID_FILE"elseecho "kkFileView进程尚未运行!"fi
fi


http://www.mrgr.cn/news/70474.html

相关文章:

  • 数据结构--链表实现栈和队列
  • 2024大数据职业技能竞赛(国赛)模块E-工业 用折线图展示设备OP160每日的运行时长
  • 小白投资理财 - 解读威廉分形指标 Williams Fractals
  • SpringCloud Gateway转发请求到同一个服务的不同端口
  • 【专题】中国企业出海洞察报告暨解码全球制胜之道报告汇总PDF洞察(附原数据表)
  • Linux环境开启MongoDB的安全认证
  • TypeScript:现代 JavaScript 的超级集
  • Linux——gcc编译过程详解与ACM时间和进度条的制作
  • 【SpringMVC】基础入门(1)
  • HTTP TCP三次握手深入解析
  • 排序算法(2)
  • 【Linux】网络编程2
  • mysql中数据不存在却查询到记录?
  • 数学与统计计算:Python math 与 statistics库基础教程
  • ima.copilot-腾讯智能工作台
  • Android 各个版本授予应用信息权限及单次弹窗确认权限
  • 每日算法练习
  • 海南华志亿星电子商务有限公司是真的吗?
  • 如何加密源代码?十条策略教你源代码防泄漏
  • 三种读取配置文件的方式
  • 基于卷积神经网络的桃子叶片病虫害识别与防治系统,vgg16,resnet,swintransformer,模型融合(pytorch框架,python代码)
  • Linux网络的基本设置
  • 为什么白帽SEO比黑帽SEO更值得坚持?
  • 大顶堆的基本操作
  • vivado+modelsim: xxx is not a function name
  • 吃透红利!AI绘画变现方法汇总|变现方式:哪一种最适合你?方法加实践,小白也能上手赚钱!