Crond服务+Shell实现秒级任务
2024-09-08 15:37:26
服务
[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
来源:简书
简书著作权归作者所有,任何形式的转载都请联系作者获得授权并注明出处。
最新文章
- datagrid与webAPI的数据交互(ef mvc )
- ES6 will change the way you write JS code.
- http://tool.oschina.net 在线API文档库java jquery ,php,很全的文档库
- 《UML大战需求分析》阅读笔记5
- 解析UML9种图的作用
- 06-C语言运算符2
- adnroid仿miui的dialog
- 【转】深入理解RunLoop
- 借助Redis做秒杀和限流的思考
- Codeforces Round #432 (Div. 1) B. Arpa and a list of numbers
- 超参数调试、Batch正则化和编程框架
- Mac系统安装和配置tomcat步骤详解
- priority_queue的优先级变化(结构体的写法)
- python的日志模块:logging;django的日志系统;django日志输出时间修改
- js 内置函数 内置对象
- mysql中,通过json_insert函数向json字段插入键值?json_insert函数的使用?
- DOM实战-js todo
- HDUOJ----The Number Off of FFF
- TensorFlow——深度学习笔记
- EffectiveJava(6)消除过期对象的引用
热门文章
- C++ 调用 Python(通过Boost.Python)
- 学习ASP.NET Core Blazor编程系列二——第一个Blazor应用程序(完)
- 002-ImageNetClassificationDeep2017
- 最强cron解析器
- 第六章:Django 综合篇 - 9:序列化 serializers
- 官方文档----ProxySQL 1.4.2 现在支持原生集群!!!
- 使用 Auditbeat 模块监控 shell 命令
- 使用Kuboard界面在k8s上部署SpringCloud项目
- 面向制造企业普适性ERP、MES类产品为什么那么难找?
- ERP 软件为什么很贵?