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下

  • 相关阅读:
    关于微服务的协议概述
    Eclipse 安装阿里巴巴代码规范插件
    Eclipse安装LomBok插件
    关于JAVA架构师
    关于Object类的一些方法
    [SoapUI] SoapUI官方文档
    [Jmeter] 用xsltproc生成html格式的报告
    [RF] Robot Framework新手干货(转载)
    【SoapUI】比较Json response
    怎样查看一个端口有无开启
  • 原文地址:https://www.cnblogs.com/flowjacky/p/4310804.html
Copyright © 2011-2022 走看看