当前位置: 技术问答>linux和unix
crontab -e 异常
来源: 互联网 发布时间:2017-05-13
本文导语: 大家好,我的一个脚本用crontab定时运行,我做了如下操作: 1. crontab -e 2. 添加内容 1 * * * * /home/my_path/getIp.sh (每小时的第一分钟执行) 3. wq 保存 头几个小时挺稳定的,后来就不执行了,我用crontab -e 看了一...
大家好,我的一个脚本用crontab定时运行,我做了如下操作:
1. crontab -e
2. 添加内容 1 * * * * /home/my_path/getIp.sh (每小时的第一分钟执行)
3. wq 保存
头几个小时挺稳定的,后来就不执行了,我用crontab -e 看了一下,里面多了几千行很多东西,而且我添加的任务也被冲掉了,crontab -e 显示如下:
s file to introduce tasks to be run by cron.
#
# Each task to run has to be defined through a single line
# indicating with different fields when the task will be run
# and what command to run for the task
#
# To define the time you can provide concrete values for
# minute (m), hour (h), day of month (dom), month (mon),
# and day of week (dow) or use '*' in these fields (for 'any').#
# Notice that tasks will be started based on the cron's system
# daemon's notion of time and timezones.
# Edit this file to introduce tasks to be run by cron.
# Edit this file to introduce tasks to be run by cron.
# Edit this file to introduce tasks to be run by cron.
# Edit this file to introduce tasks to be run by cron.
#
# Each task to run has to be defined through a single line
# indicating with different fields when the task will be run
# and what command to run for the task
#
# To define the time you can provide concrete values for
# minute (m), hour (h), day of month (dom), month (mon),
# and day of week (dow) or use '*' in these fields (for 'any').#
# Notice that tasks will be started based on the cron's system
。。。。。。
后面还有几千行
请问这是怎么回事啊,我的操作方法不对吗,请帮忙指教一下,谢谢大家了!
1. crontab -e
2. 添加内容 1 * * * * /home/my_path/getIp.sh (每小时的第一分钟执行)
3. wq 保存
头几个小时挺稳定的,后来就不执行了,我用crontab -e 看了一下,里面多了几千行很多东西,而且我添加的任务也被冲掉了,crontab -e 显示如下:
s file to introduce tasks to be run by cron.
#
# Each task to run has to be defined through a single line
# indicating with different fields when the task will be run
# and what command to run for the task
#
# To define the time you can provide concrete values for
# minute (m), hour (h), day of month (dom), month (mon),
# and day of week (dow) or use '*' in these fields (for 'any').#
# Notice that tasks will be started based on the cron's system
# daemon's notion of time and timezones.
# Edit this file to introduce tasks to be run by cron.
# Edit this file to introduce tasks to be run by cron.
# Edit this file to introduce tasks to be run by cron.
# Edit this file to introduce tasks to be run by cron.
#
# Each task to run has to be defined through a single line
# indicating with different fields when the task will be run
# and what command to run for the task
#
# To define the time you can provide concrete values for
# minute (m), hour (h), day of month (dom), month (mon),
# and day of week (dow) or use '*' in these fields (for 'any').#
# Notice that tasks will be started based on the cron's system
。。。。。。
后面还有几千行
请问这是怎么回事啊,我的操作方法不对吗,请帮忙指教一下,谢谢大家了!
|
试试看这样
crontab -e
01 * * * * sh /home/my_path/getIp.sh
crontab -e
01 * * * * sh /home/my_path/getIp.sh
|
1.crontab -e 修改为:
01 * * * * /home/my_path/getIp.sh
2.保存定时任务后,执行如下命令,重启定时任务:
service cron restart
01 * * * * /home/my_path/getIp.sh
2.保存定时任务后,执行如下命令,重启定时任务:
service cron restart
您可能感兴趣的文章:
本站(WWW.)旨在分享和传播互联网科技相关的资讯和技术,将尽最大努力为读者提供更好的信息聚合和浏览方式。
本站(WWW.)站内文章除注明原创外,均为转载、整理或搜集自网络。欢迎任何形式的转载,转载请注明出处。
本站(WWW.)站内文章除注明原创外,均为转载、整理或搜集自网络。欢迎任何形式的转载,转载请注明出处。