zoukankan      html  css  js  c++  java
  • linux定时访问url

    cd /root 
    touch test.sh #创建文件
    vim test.sh
    
    #!/bin/sh
    URL="url地址"
    curl $URL
    
    保存 退出
    
    #修改文件属性,使其可以执行
    chmod +x /root/test.sh
    
    修改/etc/crontab
    
    45 22 * * * root /root/test.sh #表示每天22点45分执行备份
    
    # * * * * *  
    #分钟 小时 天 月 星期
    
    比如
    10 3 * * 0,6 hello
    就是每周六、周日的3点10分执行hello程序。
    15 4 * * 4-6 hello
    就是从周四到周六的4点15点执行hello程序。
    
    */2   *   *   *   *           root      ...............      #每两分钟就执行........ 
    0 6,12,18   *   *   *    root      ...............      #每天6点、12点、18点执行........
    
    每两个小时
    0 */2 * * * 
    晚上11点到早上8点之间每两个小时,早上八点
    0 23-7/28 * * * 
    每个月的4号与每个礼拜的礼拜一到礼拜三的早上11点
    0 11 4 * 1-3 
    1月1日早上4点
    0 4 1 1 * 
    
    #重新启动crond使设置生效
    
    service cron stop #停止
    
    service cron start #启动
    
    /etc/init.d/cron restart #重启
  • 相关阅读:
    Vue常见问题总结
    vue学习记录
    内卷
    at least once 和 at most once 问题
    IO学习笔记(全)
    IO学习笔记7
    IO学习笔记6
    IO学习笔记5
    IO学习笔记4
    IO学习笔记3
  • 原文地址:https://www.cnblogs.com/jthb/p/3361934.html
Copyright © 2011-2022 走看看