开机启动java
crontab -e
service crond restart
* * * * * . /etc/profile;/bin/sh /root/start8080.sh
*/30 * * * * sh /root/clear.sh
#!/bin/sh
#切换到目录
cd /opt/blog
date=`date`
#查询端口占用
lsof -i:8080
# $? -ne 0 不存在 $? -eq 0存在
if [ $? -ne 0 ]
then
nohup java -jar rs0322-blog.jar >/opt/blog/nohup.out &
echo $date ":=============== restart ===============" >> nohup.log
else
echo $date ":=============== is normal ==============" >> nohup.log
fi
喜欢 | 0
文章评论