亚洲av成人无遮挡网站在线观看,少妇性bbb搡bbb爽爽爽,亚洲av日韩精品久久久久久,兔费看少妇性l交大片免费,无码少妇一区二区三区

Chinaunix

標(biāo)題: crontab 異常 [打印本頁(yè)]

作者: wang_qiao_ying    時(shí)間: 2014-02-19 18:37
標(biāo)題: crontab 異常
大家好,我的一個(gè)腳本用crontab定時(shí)運(yùn)行,我做了如下操作:
1. crontab -e
2. 添加內(nèi)容 1 * * * * /home/my_path/getIp.sh (每小時(shí)的第一分鐘執(zhí)行)
3. wq 保存

頭幾個(gè)小時(shí)挺穩(wěn)定的,后來(lái)就不執(zhí)行了,我用crontab -e 看了一下,里面多了幾千行很多東西,而且我添加的任務(wù)也被沖掉了,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
。。。。。。
后面還有幾千行

請(qǐng)問(wèn)這是怎么回事啊,我的操作方法不對(duì)嗎,請(qǐng)幫忙指教一下,謝謝大家了!
作者: runintostar    時(shí)間: 2014-02-19 18:44
介意發(fā)下你的那個(gè)腳本嗎,這里目前沒(méi)看出問(wèn)題也
作者: elu_ligao    時(shí)間: 2014-02-19 21:28
注釋的內(nèi)容是循環(huán)的? 找到原因希望分享, 謝謝
作者: Shell_HAT    時(shí)間: 2014-02-19 22:17
腳本內(nèi)容貼出來(lái)看看
作者: q1208c    時(shí)間: 2014-02-20 08:22
我覺(jué)得象是樓主在編輯 cron 的時(shí)候手抖了, 結(jié)果 復(fù)制了一堆前面的注釋下來(lái).

另外, 查看 crontab 的 命令是 crontab -l , 不是 crontab -e . 樓主這么用命令, 不出事才奇怪呢.

Good Luck !!
作者: wang_qiao_ying    時(shí)間: 2014-02-20 09:29
內(nèi)容很簡(jiǎn)單啊 就兩行

#!/bin/bash

#獲取動(dòng)態(tài)ip地址
ipaddr=`wget -O - -q icanhazip.com`   
#發(fā)郵件
echo $ipaddr | /opt/mailx-12.4/mailx  -s "Remote Route Ip from sms server(104) " my_email@126.com     
作者: wang_qiao_ying    時(shí)間: 2014-02-20 09:31
哈哈,5樓的兄弟真會(huì)說(shuō)笑。 我確實(shí)是用crontab -l 查看的。
作者: wang_qiao_ying    時(shí)間: 2014-02-20 09:40
急死了,我的工程需要ssh遠(yuǎn)程調(diào)試,但是遠(yuǎn)程的ip地址是動(dòng)態(tài)的,我只能通過(guò)郵件定期把動(dòng)態(tài)ip發(fā)過(guò)來(lái)。  這crontab掛了,我還得親自去現(xiàn)場(chǎng)查看ip
作者: runintostar    時(shí)間: 2014-02-20 09:53
回復(fù) 8# wang_qiao_ying

不知道你用的是什么OS,看上去像linux,不曉得有什么command可以查看文件是否被別的用戶和進(jìn)程修改了。

重新編輯好你的crontab之后
在/var/spool/cron下找到你這個(gè)用戶的crontab文件
把文件改成只讀的,這也許可以暫時(shí)幫到你

   
作者: wang_qiao_ying    時(shí)間: 2014-02-20 10:00
我用的是redhat系統(tǒng),照你的方法試下吧,希望能有幫助,非常感謝!

我就是想知道是什么東西把文件內(nèi)容修改了,真奇怪。
作者: jackhuntcn    時(shí)間: 2014-02-20 10:05
看下auditd日志,默認(rèn)應(yīng)該會(huì)審計(jì)crontab的~~
作者: wang_qiao_ying    時(shí)間: 2014-02-20 10:18
是查看 /var/log/audit/audit.log 的日志嗎,怎么分析內(nèi)容啊,沒(méi)用過(guò)這個(gè),請(qǐng)指教一下,謝了!
作者: three_body    時(shí)間: 2014-02-21 10:46
看看/var/log/cron里面記錄的內(nèi)容。




歡迎光臨 Chinaunix (http://www.72891.cn/) Powered by Discuz! X3.2