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
。。。。。。
后面还有几千行
请问这是怎么回事啊,我的操作方法不对吗,请帮忙指教一下,谢谢大家了!
------解决方案--------------------试试看这样
crontab -e
01 * * * * sh /home/my_path/getIp.sh
------解决方案--------------------1.crontab -e 修改为:
01 * * * * /home/my_path/getIp.sh
2.保存定时任务后,执行如下命令,重启定时任务:
service cron restart