zoukankan      html  css  js  c++  java
  • crontab误删除

    命令如下:

    cat /var/log/cron* | grep -i "`which cron`" > ./all_temp
     
    cat  ./all_temp | grep -v "<command>" > ./cmd_temp

    用awk读取cmd_temp,即可得到命令。

    [script-02 tmp]$ cat cmd_temp  | grep username | awk -F 'CMD' '{print $2}' | sort | uniq
    
     (bash   /home/appadmin/script/security/auto_restart.sh)

    命令是找回了,可是执行周期呢?还是靠cmd_temp。

    复制代码
    [script-02 tmp]$ cat cmd_temp  | grep /home/appadmin/script/security/auto_restart.sh | head                   
    Sep 11 03:44:01 script-02 CROND[18487]: (appadmin) CMD (bash   /home/appadmin/script/security/auto_restart.sh)
    Sep 11 03:45:01 script-02 CROND[18522]: (appadmin) CMD (bash   /home/appadmin/script/security/auto_restart.sh)
    Sep 11 03:46:01 script-02 CROND[18844]: (appadmin) CMD (bash   /home/appadmin/script/security/auto_restart.sh)
    Sep 11 03:47:01 script-02 CROND[18870]: (appadmin) CMD (bash   /home/appadmin/script/security/auto_restart.sh)
    Sep 11 03:48:01 script-02 CROND[18901]: (appadmin) CMD (bash   /home/appadmin/script/security/auto_restart.sh)
    Sep 11 03:49:01 script-02 CROND[19036]: (appadmin) CMD (bash   /home/appadmin/script/security/auto_restart.sh)
    Sep 11 03:50:01 script-02 CROND[19073]: (appadmin) CMD (bash   /home/appadmin/script/security/auto_restart.sh)
    Sep 11 03:51:01 script-02 CROND[19147]: (appadmin) CMD (bash   /home/appadmin/script/security/auto_restart.sh)
    Sep 11 03:52:01 script-02 CROND[19286]: (appadmin) CMD (bash   /home/appadmin/script/security/auto_restart.sh)
    Sep 11 03:53:01 script-02 CROND[19312]: (appadmin) CMD (bash   /home/appadmin/script/security/auto_restart.sh)
    复制代码

    可以很明显的看出,命令是一分钟一次。

    全部恢复完成后已经是下班后一个小时了。不管怎么样,总算把自己坑填好了。

  • 相关阅读:
    HttpClient上传文件(转)
    数据库查询结果导出到excel
    docker报错“net/http: TLS handshake timeout”
    java线程的几个状态和锁的作用范围
    简单管理WPF及Winform所有弹出窗体
    FastJson学习
    基于消息中间件实现流量削峰
    pandas
    DBSCAN
    A value is trying to be set on a copy of a slice from a DataFrame. Try using .loc[row_indexer,col_indexer] = value instead
  • 原文地址:https://www.cnblogs.com/laogui/p/8919077.html
Copyright © 2011-2022 走看看