37 lines
1.0 KiB
Bash
37 lines
1.0 KiB
Bash
while true
|
|
do
|
|
ONE='one'
|
|
ONE_FILE='./one/syb.jar'
|
|
ONE_TIME=$(stat -c %Y $ONE_FILE)
|
|
|
|
ANOTHER='another'
|
|
ANOTHER_FILE='./another/syb.jar'
|
|
ANOTHER_TIME=$(stat -c %Y $ANOTHER_FILE)
|
|
|
|
if [ "$ONE_TIME" -gt "$ANOTHER_TIME" ]
|
|
then
|
|
FILE_NAME="$ONE_FILE"
|
|
FOLD="$ONE"
|
|
else
|
|
FILE_NAME="$ANOTHER_FILE"
|
|
FOLD="$ANOTHER"
|
|
fi
|
|
|
|
echo "最新的文件是${FILE_NAME}"
|
|
echo "最新的文件夹是${FOLD}"
|
|
|
|
# 先操作7004的端口
|
|
proc70041=$(pgrep -f "${ONE_FILE} --spring.profiles.active=prod$")
|
|
proc70042=$(pgrep -f "${ANOTHER_FILE} --spring.profiles.active=prod$")
|
|
if [ "$proc70041"x == "x" ] && [ "$proc70042"x == "x" ] ; then
|
|
./apiStart7004.sh $FOLD
|
|
fi
|
|
|
|
# 再操作7014
|
|
proc70141=$(pgrep -f "${ONE_FILE} --spring.profiles.active=prod --server.port=7014$")
|
|
proc70142=$(pgrep -f "${ANOTHER_FILE} --spring.profiles.active=prod --server.port=7014$")
|
|
if [ "$proc70141"x == "x" ] && [ "$proc70142"x == "x" ] ; then
|
|
./apiStart7014.sh $FOLD
|
|
fi
|
|
sleep 30
|
|
done |