zoukankan      html  css  js  c++  java
  • 自动化部署

    1、编写需要执行的shell脚本:
    // 大意:先杀掉进程,再清除日志,再重启jar服务
    echo "重启webSocket" pidlist=`ps -ef |grep SystemCommunication |grep -v "grep"|awk '{print $2}'` kill -9 $pidlist rm $webSocket_home/nohup.out nohup /home/software/jdk1.8.0_221/bin/java -jar /home/SystemCommunication.jar > /home/utry/nohup.out &

    2、设置定时任务:

    crontab -e  // 编辑Linux定时任务配置文件
    
    05 16 * * * /home/webSocketStart.sh
    
    crontab -l  // 查看当前所有的定时任务
    
    05 16 * * * /home/webSocketStart.sh

    3、查看定时任务日志:

    tail -f /var/log/cron
    
    Oct 21 16:02:16 localhost crontab[12132]: (root) END EDIT (root)
    Oct 21 16:02:37 localhost crontab[12166]: (root) LIST (root)
    Oct 21 16:03:01 localhost crond[675]: (root) RELOAD (/var/spool/cron/root)
    Oct 21 16:03:01 localhost CROND[12249]: (root) CMD (/home/utry/webSocketStart.sh)
    Oct 21 16:04:01 localhost crontab[12392]: (root) BEGIN EDIT (root)
    Oct 21 16:04:22 localhost crontab[12392]: (root) REPLACE (root)
    Oct 21 16:04:22 localhost crontab[12392]: (root) END EDIT (root)
    Oct 21 16:05:01 localhost crond[675]: (root) RELOAD (/var/spool/cron/root)
    Oct 21 16:05:01 localhost CROND[12503]: (root) CMD (/home/utry/webSocketStart.sh)
    Oct 21 16:09:44 localhost crontab[12982]: (root) BEGIN EDIT (root)
    Oct 21 16:12:19 localhost crontab[12982]: (root) REPLACE (root)
    Oct 21 16:12:19 localhost crontab[12982]: (root) END EDIT (root)
    Oct 21 16:13:01 localhost crond[675]: (root) RELOAD (/var/spool/cron/root)
    Oct 21 16:14:07 localhost crontab[13419]: (root) BEGIN EDIT (root)
    Oct 21 16:14:38 localhost crontab[13419]: (root) REPLACE (root)
    Oct 21 16:14:38 localhost crontab[13419]: (root) END EDIT (root)
    Oct 21 16:14:41 localhost crontab[13456]: (root) LIST (root)
    Oct 21 16:15:01 localhost crond[675]: (root) RELOAD (/var/spool/cron/root)
  • 相关阅读:
    字符串数组和字符串的转换
    项目总结3
    解决几种中文乱码的问题
    ipms的sql语句
    ipms综合管理系统的总结2
    ipms综合管理系统的总结
    简答题汇总
    log4net根据日志类型写入到不同的文件中
    NUnit单元测试初试
    log4net
  • 原文地址:https://www.cnblogs.com/dk1024/p/13853002.html
Copyright © 2011-2022 走看看