crontab 定时任务守护程序,停止服务器时出现 job for * canceled
(1)首先要在程序启动的时候加入定时任务到crontab
#! /bin/sh
mkdir -p /home/apps/components/ams/ 2>/dev/null
cp ./amswatchdog.sh /home/apps/components/ams/
CRONTAB_CMD="* * * * * sh /home/apps/components/ams/amswatchdog.sh
* * * * * sleep 10;sh /home/apps/components/ams/amswatchdog.sh
* * * * * sleep 20;sh /home/apps/components/ams/amswatchdog.sh
* * * * * sleep 30;sh /home/apps/components/ams/amswatchdog.sh
* * * * * sleep 40;sh /home/apps/components/ams/amswatchdog.sh
* * * * * sleep 50;sh /home/apps/components/ams/amswatchdog.sh"
(crontab -l 2>/dev/null | grep -Fv /home/apps/components/ams/amswatchdog.sh; echo "$CRONTAB_CMD") | crontab -
(2)停止服务器时,要清除crontab中的定时任务,并重新加载定时任务,重启crontab服务器
#! /bin/sh
(crontab -l 2>/dev/null | grep -Fv /home/apps/components/ams/amswatchdog.sh) | crontab -
service crond reload
service crond restart
(3)还要清除正在执行的定时job,查询并杀死正在执行的amswatchdog.sh进程,否则会出现job for ** canceled的错误,导致服务停止不了;
ps -ef | grep amswatchdog.sh | grep -v grep | awk '{print $2}' |xargs kill -9
crontab 定时任务守护程序,停止服务器时出现 job for * canceled的更多相关文章
- Linux crontab 定时任务
http://linuxtools-rst.readthedocs.io/zh_CN/latest/tool/crontab.html 19. crontab 定时任务 通过crontab 命令,我们 ...
- 使用Ubuntu的Crontab定时任务需要注意的地方
Ubuntu使用crontab定时任务 网上有很多教程,现在记录下我遇到的一些问题,需要注意的地方: 1.定时任务的日志存放路径 网上的说法:cron的日志存放在 /var/log/cron 里面 ...
- crontab定时任务_net
2017年2月25日, 星期六 crontab定时任务 19. crontab 定时任务 通过crontab 命令,我们可以在固定的间隔时间执行指定的系统指令或 shell script脚本.时间间隔 ...
- Linux下实现秒级的crontab定时任务
crontab的格式如下 * * * * * command 分 时 日 月 周 命令 第1列表示分钟1-59 每分钟用*或者 */1表示 第2列表示小时1-23(0表示0点) 第3列表示日期1-31 ...
- crontab 定时任务格式
如下内容节选自<Linux Crontab 定时任务 命令详解> 用crontab -e 添加要执行的命令 添加的命令必须以如下格式: * * * * * /command path 前五 ...
- scrapy使用crontab定时任务不能自动执行的调试
在用crontab进行定时任务时,发现任务并没有执行.而手动bash yourshell.sh时可以正常的执行程序.以下是个人的解决流程. 一.将错误打印打out.log */10 * * * * b ...
- crontab定时任务以及其中中文乱码问题
一.小例子 1.写个测试文件 2.将文件权限变为可执行文件 3.在crontab文件中写定时任务 格式: 分/时 * * * 用户名 可执行文件路径 >> log文件路径 2>&am ...
- crontab定时任务不执行的原因
1.重启crontab若是遇见"You (cloudlogin) are not allowed to use this program (crontab) ...
- 使用linux下的crontab定时任务跑定时脚本
使用linux下的crontab定时任务跑定时脚本 tags:定时任务 定时脚本 crontab linux定时脚本 linux 引言:应该有许多人曾经很好奇一些定时脚本是怎么做出来的.我们这次就来说 ...
随机推荐
- js和native交互方法浅析
一.背景 最近接触公司项目,需要和原生app做交互,由此业务需求,开始了学习探索之路. 二.解决方案之WebViewJavascriptBridge 想要和app交互,必须在app上先把bridge进 ...
- 2017 Multi-University Training Contest - Team 9 1004&&HDU 6164 Dying Light【数学+模拟】
Dying Light Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 131072/131072 K (Java/Others)Tot ...
- [ZOJ3256] Tour in the Castle
插头DP+矩阵乘法 m喜闻乐见地达到了10^9级别..而n<=7,并且没有障碍..所以列与列之间的转移时一样的..就可以上矩乘了. 感觉自己快没救了..看半天题解还是不懂.. http://ww ...
- Winform 控件的入门级使用(一)
开始总结一下控件的基本用法,方便以后查阅. 一.Label Label 的使用频率很高,基本上也没有什么难度. #region Winform //label label.Text = "这 ...
- 【django基础补充之URL,视图,模版】
一.url路由配置 URL配置(URLconf)就像Django 所支撑网站的目录.它的本质是URL与要为该URL调用的视图函数之间的映射表:你就是以这种方式告诉Django,对于这个URL调用这段代 ...
- phpstudy php5.4以上版本伪静态设置 thinkphp
http://www.thinkphp.cn/topic/35958.html <IfModule mod_rewrite.c> Options +FollowSymlinks -Mult ...
- sql 中文转拼音首字母
http://blog.csdn.net/zhanglong_longlong/article/details/46772571 --可支持大字符集20000个汉字! create function ...
- 用Dedecms5.7的arclist标签调用文章内容
arclist标签调用文章内容 首先大家都知道在Dedecms中,list标签是可以调用文章内容的,调用格式就不再此冗述了.从我个人来说,我非常不喜欢用list标签调用,有可能我会尽量使用arclis ...
- Idea Maven创建Web项目
1.创建Maven项目 1.1File->New->Project 1.2填写GroupId和ArtifactId 1.3直接Finish,然后等一会,等Maven加载完 完成以后的项目结 ...
- 【问题解决】Eclipse中 ctrl+空格 content assist
改一下你的快捷键设置:window->perferences-->keys--->查找 content assist--->把这个地方改成你想要的就可以了.!