zoukankan      html  css  js  c++  java
  • 计划任务crontab

    参考:

      http://blog.csdn.net/xrt95050/article/details/3980567

      http://www.cnblogs.com/zhenmingliu/archive/2012/04/27/2472958.html

    服务名称:crond

    查看服务状态示例:

    service crond status
    systemctl status crond    #CentOS 7

    设置方法:

      1.命令行运行:crontab -e

      2.命令行运行:vim /etc/crontab 添加内容

        示例:

    SHELL=/bin/bash
    PATH=/sbin:/bin:/usr/sbin:/usr/bin
    MAILTO=root                            
    
    # For details see man 4 crontabs
    
    # Example of job definition:
    # .---------------- minute (0 - 59)
    # |  .------------- hour (0 - 23)
    # |  |  .---------- day of month (1 - 31)
    # |  |  |  .------- month (1 - 12) OR jan,feb,mar,apr ...
    # |  |  |  |  .---- day of week (0 - 6) (Sunday=0 or 7) OR sun,mon,tue,wed,thu,fri,sat
    # |  |  |  |  |
    # *  *  *  *  * user-name  command to be executed
    
    45 */1 * * * root /usr/local/bin/sshpass -p "abcdefg" ssh -p2222 ghost@123.123.123.123  #每小时的第45分钟以root用户ssh登录主机123.123.123.123

    若要关闭邮件通知:

    45 */1 * * * root /usr/local/bin/sshpass -p "abcdefg" ssh -p2222 ghost@123.123.123.123 >/dev/null 2>&1

    PS

      手动删除/var/log/secure的内容后,需要重启日志服务:service rsyslog restart    #CentOS下

  • 相关阅读:
    异象石(引理证明)
    Codeforces Round #664 (Div. 2)
    2020 年百度之星·程序设计大赛
    Codeforces Round #663 (Div. 2)
    Codeforces Round #662 (Div. 2)
    相等运算符
    Unicode编码
    算术运算符
    强制类型转换到Boolean
    强制类型转换到Number
  • 原文地址:https://www.cnblogs.com/flowjacky/p/4310804.html
Copyright © 2011-2022 走看看