服务

[root@19-v1-centos-6 ~]# chkconfig --list | grep crond
crond 0:off 1:off 2:on 3:on 4:on 5:on 6:off

查看任务

[root@19-v1-centos-6 ~]# crontab -l
*/1 * * * * sh /server/scripts/task_start.sh

编辑任务

[root@19-v1-centos-6 ~]# crontab -e

Shell 脚本

[root@19-v1-centos-6 ~]# mkdir -p /server/scripts/
[root@19-v1-centos-6 ~]# mkdir -p /server/logs/

脚本内容

#! /bin/bash
task_url=("http://192.168.32.1/task.php/task/check_order" "http://192.168.32.1/task.php/task/check_robot_online")
for n in `seq 10`
do
for task in ${task_url[*]}
do
curl $task >> /server/logs/task.log
done
sleep 6
done

这个脚本其实就是已秒级去请求shell,如果shell去做后台运行加&,可能会死掉,重启也没有了,but crond最低是分级别的任务,所以crond+shell实现秒就很简单了。

 

作者:Godtoy
链接:https://www.jianshu.com/p/2dcda651c94d
来源:简书
简书著作权归作者所有,任何形式的转载都请联系作者获得授权并注明出处。

最新文章

  1. datagrid与webAPI的数据交互(ef mvc )
  2. ES6 will change the way you write JS code.
  3. http://tool.oschina.net 在线API文档库java jquery ,php,很全的文档库
  4. 《UML大战需求分析》阅读笔记5
  5. 解析UML9种图的作用
  6. 06-C语言运算符2
  7. adnroid仿miui的dialog
  8. 【转】深入理解RunLoop
  9. 借助Redis做秒杀和限流的思考
  10. Codeforces Round #432 (Div. 1) B. Arpa and a list of numbers
  11. 超参数调试、Batch正则化和编程框架
  12. Mac系统安装和配置tomcat步骤详解
  13. priority_queue的优先级变化(结构体的写法)
  14. python的日志模块:logging;django的日志系统;django日志输出时间修改
  15. js 内置函数 内置对象
  16. mysql中,通过json_insert函数向json字段插入键值?json_insert函数的使用?
  17. DOM实战-js todo
  18. HDUOJ----The Number Off of FFF
  19. TensorFlow——深度学习笔记
  20. EffectiveJava(6)消除过期对象的引用

热门文章

  1. C++ 调用 Python(通过Boost.Python)
  2. 学习ASP.NET Core Blazor编程系列二——第一个Blazor应用程序(完)
  3. 002-ImageNetClassificationDeep2017
  4. 最强cron解析器
  5. 第六章:Django 综合篇 - 9:序列化 serializers
  6. 官方文档----ProxySQL 1.4.2 现在支持原生集群!!!
  7. 使用 Auditbeat 模块监控 shell 命令
  8. 使用Kuboard界面在k8s上部署SpringCloud项目
  9. 面向制造企业普适性ERP、MES类产品为什么那么难找?
  10. ERP 软件为什么很贵?