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)
  • 相关阅读:
    牛客(28)数组中出现次数超过一半的数字
    牛客(27)字符串的排列
    2、Spring Cloud和dubbo简介
    1、微服务简介
    12、Spring Boot监控
    11、Spring Boot热部署
    10、Spring Boot分布式
    9、Spring Boot安全
    8、Spring Boot任务
    7、Spring Boot检索
  • 原文地址:https://www.cnblogs.com/dk1024/p/13853002.html
Copyright © 2011-2022 走看看