关于cron的问题.
时间:2004-09-12
来源:互联网
我的crontab文件:
-su-2.05b# less /etc/crontab
# /etc/crontab - root's crontab for FreeBSD
#
# $FreeBSD: src/etc/crontab,v 1.32 2002/11/22 16:13:39 tom Exp $
#
SHELL=/bin/sh
PATH=/etc:/bin:/sbin:/usr/bin:/usr/sbin
HOME=/var/log
#
#minute hour mday month wday who command
#
*/5 * * * * root /usr/libexec/atrun
*/5 * * * * root /bin/mrtg.sh
#update the Virus data file
#0 */12 * * * root /usr/local/libexec/uvscan/update.sh
# Save some entropy so that /dev/random can re-seed on boot.
*/11 * * * * operator /usr/libexec/save-entropy
# Rotate log files every hour, if necessary.
0 * * * * root newsyslog
/etc/crontab (END)
我的cron日志:
-su-2.05b# less cron
Sep 12 14:19:00 www /usr/sbin/cron[4435]: (*system*) RELOAD (/etc/crontab)
Sep 12 14:20:00 www /usr/sbin/cron[28039]: (root) CMD (/bin/mrtg.sh)
Sep 12 14:20:00 www /usr/sbin/cron[28040]: (root) CMD (/usr/libexec/atrun)
Sep 12 14:22:00 www /usr/sbin/cron[28050]: (operator) CMD (/usr/libexec/save-entropy)
#########################
注意上面红色的部分,是我需要的,下面的日志显示也已经执行了,可是真实的情况当我查看mrtg的时候,并不是那样的.
我在shell下面直接执行:/bin/mrtg.sh是可以的.
想询问有谁遇到过这样的问题?或许是什么地方出错了?给个提示.谢谢.
附我的mrtg.sh:
-su-2.05b# less /bin/mrtg.sh
#!/bin/sh
mrtg /usr/local/etc/mrtg/packet-mrtg.cfg
/bin/mrtg.sh (END)
-su-2.05b# less /etc/crontab
# /etc/crontab - root's crontab for FreeBSD
#
# $FreeBSD: src/etc/crontab,v 1.32 2002/11/22 16:13:39 tom Exp $
#
SHELL=/bin/sh
PATH=/etc:/bin:/sbin:/usr/bin:/usr/sbin
HOME=/var/log
#
#minute hour mday month wday who command
#
*/5 * * * * root /usr/libexec/atrun
*/5 * * * * root /bin/mrtg.sh
#update the Virus data file
#0 */12 * * * root /usr/local/libexec/uvscan/update.sh
# Save some entropy so that /dev/random can re-seed on boot.
*/11 * * * * operator /usr/libexec/save-entropy
# Rotate log files every hour, if necessary.
0 * * * * root newsyslog
/etc/crontab (END)
我的cron日志:
-su-2.05b# less cron
Sep 12 14:19:00 www /usr/sbin/cron[4435]: (*system*) RELOAD (/etc/crontab)
Sep 12 14:20:00 www /usr/sbin/cron[28039]: (root) CMD (/bin/mrtg.sh)
Sep 12 14:20:00 www /usr/sbin/cron[28040]: (root) CMD (/usr/libexec/atrun)
Sep 12 14:22:00 www /usr/sbin/cron[28050]: (operator) CMD (/usr/libexec/save-entropy)
#########################
注意上面红色的部分,是我需要的,下面的日志显示也已经执行了,可是真实的情况当我查看mrtg的时候,并不是那样的.
我在shell下面直接执行:/bin/mrtg.sh是可以的.
想询问有谁遇到过这样的问题?或许是什么地方出错了?给个提示.谢谢.
附我的mrtg.sh:
-su-2.05b# less /bin/mrtg.sh
#!/bin/sh
mrtg /usr/local/etc/mrtg/packet-mrtg.cfg
/bin/mrtg.sh (END)
作者: Only_end 发布时间: 2004-09-12
#!/bin/sh
/PATH/mrtg /usr/local/etc/mrtg/packet-mrtg.cfg
命令mrtg加上绝对路径试试.
/PATH/mrtg /usr/local/etc/mrtg/packet-mrtg.cfg
命令mrtg加上绝对路径试试.
作者: congli 发布时间: 2004-09-13
不是这个问题我想
作者: sunjinsong 发布时间: 2004-09-13
如congli所说.
谢谢指教.
谢谢指教.
作者: Only_end 发布时间: 2004-09-13
你不是说,不用cron 可以直接运行的吗?
想不明白,,原因?
想不明白,,原因?
作者: sunjinsong 发布时间: 2004-09-13
我的mrtg命令是在/usr/local/bin
使用shell来执行的时候,他可以找到mrtg命令。
可是让cron来执行, 他的PATH没有包含这个路径,所以不能找到这个命令。如此而已。
另外的方法感觉是修改/etc/crontab文件的PATH变量,不过我没有测试过。
使用shell来执行的时候,他可以找到mrtg命令。
可是让cron来执行, 他的PATH没有包含这个路径,所以不能找到这个命令。如此而已。
另外的方法感觉是修改/etc/crontab文件的PATH变量,不过我没有测试过。
作者: Only_end 发布时间: 2004-09-13
相关阅读 更多
热门阅读
-
office 2019专业增强版最新2021版激活秘钥/序列号/激活码推荐 附激活工具
阅读:74
-
如何安装mysql8.0
阅读:31
-
Word快速设置标题样式步骤详解
阅读:28
-
20+道必知必会的Vue面试题(附答案解析)
阅读:37
-
HTML如何制作表单
阅读:22
-
百词斩可以改天数吗?当然可以,4个步骤轻松修改天数!
阅读:31
-
ET文件格式和XLS格式文件之间如何转化?
阅读:24
-
react和vue的区别及优缺点是什么
阅读:121
-
支付宝人脸识别如何关闭?
阅读:21
-
腾讯微云怎么修改照片或视频备份路径?
阅读:28