当前位置: 首页 > 工具软件 > Bistoury > 使用案例 >

bistoury 安装

端木桐
2023-12-01

安装文档

https://github.com/qunarcorp/bistoury

应用重启后,进程id变了怎么办?

1.取到进程号输入到一个文件中,并加入crontab定时任务

netstat -lpn |grep 9503 |grep -v grep|grep -v kill|awk '{print $7}' |cut -d/ -f1 > /opt/note.txt

2. 检测这个文件内容有没有发生变化,并加入crontaab定时任务

#!/bin/bash
# 检测的文件
package=/opt/note.txt
# 记录 md5值的文件
md5=package_md5
# 创建新的md5信息
package_md5_new=$(md5sum -b $package | awk '{print $1}'|sed 's/ //g')

# 创建md5的函数
function creatmd5()
{
        echo $package_md5_new > $md5
}

# 判断文件是否存在
if [ ! -f $md5 ] ; then
        echo "md5file is not exsit,create md5file......."
        creatmd5
        exit
fi

# 读取旧的md5信息
package_md5_old=$(cat $md5|sed 's/ //g')

echo $package_md5_new
echo $package_md5_old

# 对象对比判断
if [ "$package_md5_new" == "$package_md5_old" ];then
        echo "md5 is not changed"
        echo "not changed" > /tmp/notebook.txt
else
        echo "md5 is  changed"
        creatmd5
        sh /data/bistoury-2.0.5/bistoury.sh >/dev/null 2>&1
fi

3.如果文件内容有变化,执行bistoury启动脚本

#!/bin/sh
note=`netstat -lpn |grep 9503 |grep -v grep|grep -v kill|awk '{print $7}' |cut -d/ -f1`
cd /data/bistoury-2.0.5/
sh quick_start.sh stop
sleep 10
sh quick_start.sh -i 123.56.161.94 -p $note -c com.aixuexi.notebook.start.Main start
echo "ok"

 

 类似资料: