目录:
/srv/wechat
查看日志
root@wechat:/srv/wechat# cat info
#!/bin/bash
day="
(
d
a
t
e
+
"
t
a
i
l
−
f
/
s
r
v
/
p
p
k
−
l
o
g
/
p
p
k
−
w
e
c
h
a
t
/
∗
i
n
f
o
∗
(date +"%Y-%m-%d")" tail -f /srv/ppk-log/ppk-wechat/*info*
(date+"tail−f/srv/ppk−log/ppk−wechat/∗info∗day*.log
查看错误日志
root@wechat:/srv/wechat# cat error
#!/bin/bash
day="
(
d
a
t
e
+
"
t
a
i
l
−
f
/
s
r
v
/
p
p
k
−
l
o
g
/
p
p
k
−
w
e
c
h
a
t
/
∗
e
r
r
o
r
.
(date +"%Y-%m-%d")" tail -f /srv/ppk-log/ppk-wechat/*error.
(date+"tail−f/srv/ppk−log/ppk−wechat/∗error.day*.log
启动服务脚本
root@wechat:/srv/wechat# cat wechat.sh
#!/bin/bash
time="$(date +"%Y-%m-%d-%H:%M")"
fname=ls yz-ppk*
mv $fname
f
n
a
m
e
−
fname-
fname−time
mv yz-ppk* ./backup/
mv /srv/ppk-log/ppk-wechat/yz-ppk-wechat-1.0-SNAPSHOT.jar /srv/wechat
wechat=netstat -tnlp|grep 8091 | awk '{print $7}'| awk -F '/' '{print $1}'
if [ -z $wechat ];then
echo “进程不存在,直接启动微信服务号”
nohup java -jar ./yz-ppk-wechat-1.0-SNAPSHOT.jar >/dev/null 2>&1 &
else
echo “先 kill $wechat 进程,再启动微信服务号”
kill -15 $wechat
nohup java -jar ./yz-ppk-wechat-1.0-SNAPSHOT.jar >/dev/null 2>&1 &
fi
sleep 5s
netstat -ntlp
sleep 5s
netstat -ntlp
./info