zoukankan      html  css  js  c++  java
  • shell脚本实现定时重启任务并输出日志信息

    #!/bin/bash
    
    #当前日期
    time=`date`
    
    
    pidno=`ps aux|grep  adserver-beta|grep -v "grep"|awk '{print $2}'`
    
    kill -9 $pidno
    
    if [ $? -ne 0 ]; then
            echo $time"----->old adserver kill failed.." >> /tmp/yechang_adserver_restart.log
    else
            echo $time"----->old adserver kill success.." >> /tmp/yechang_adserver_restart.log
    fi
    
    sleep 5
    
    adserverpid=`ps aux|grep  adserver|grep -v "grep"|awk '{print $2}'`
    
    if [ "$adserverpid" ];then
          echo $time"----->update success! new version adserver is running now" >> /tmp/yechang_adserver_restart.log
    fi
    crontab -e
    
    38 16 * * * sh /data/sh/yechang_adserver_restart.sh > /dev/null 2>&1
  • 相关阅读:
    分数的表示和运算
    用户管理
    DML,DDL
    索引
    sql语句执行顺序
    伪劣
    序列
    视图
    完整性约束
    ASP.NET MVC学习笔记(二)登陆验证
  • 原文地址:https://www.cnblogs.com/weifeng1463/p/8618812.html
Copyright © 2011-2022 走看看