dongmu7335 2016-05-12 13:30
浏览 87
已采纳

由crontab运行的脚本不会生成数据

Using Cacti, I'm trying to run the following command:

php poller.php > test.cfg

As expected I'm getting the following output :

root@SLINUX01:[/usr/local/cacti]$tail -f test.cfg
Waiting on 1 of 1 pollers.
Waiting on 1 of 1 pollers.
Waiting on 1 of 1 pollers.
Waiting on 1 of 1 pollers.
05/12/2016 01:23:50 PM - POLLER: Poller[0] CACTI2RRD: /usr/bin/rrdtool update /usr/local/cacti/rra/stse01_traffic_in_14.rrd --template traffic_out:traffic_in 1463052230:2773678063:3900704413
05/12/2016 01:23:50 PM - POLLER: Poller[0] CACTI2RRD: /usr/bin/rrdtool update /usr/local/cacti/rra/stse01_traffic_in_15.rrd --template traffic_in:traffic_out 1463052230:1071486:1088742
05/12/2016 01:23:50 PM - SYSTEM STATS: Time:5.4128 Method:cmd.php Processes:1 Threads:N/A Hosts:3 HostsPerProcess:3 DataSources:9 RRDsProcessed:7
Loop  Time is: 5.41
Sleep Time is: 294.58
Total Time is: 5.42
^C

And my manipulated has updated.


Now using the crontab, I made the following :

*/5 * * * * cacti php /usr/local/cacti/poller.php > /home/cacti/test.cfg &>/home/cacti/test.cfg

But when i go in the /home/cacti/test.cfg after cron execution , I got nothing, but the cron runned the script :

May 12 15:25:01 SLINUX01 CROND[19871]: (root) CMD (cacti php /usr/local/cacti/poller.php > /home/cacti/test.cfg &>/home/cacti/test.cfg)

What is the source of this problem?

Thanks in advance.

  • 写回答

1条回答

      报告相同问题?

      相关推荐 更多相似问题

      悬赏问题

      • ¥15 ABAQUS简单的带传动系统运转不了
      • ¥15 关于git actions自动部署的问题
      • ¥25 小程序 view wx:for 循环太多时,如何在循环结束执行某个事件?
      • ¥15 曲率模态差matlab程序计算
      • ¥15 大概算是比较简单的坐标系旋转问题
      • ¥15 关于#python#的问题:安装完gym环境后
      • ¥15 关于稳像云台姿态控制中相机姿态误差表征
      • ¥15 求sm16306s驱动例程
      • ¥15 本地生活媒体平台口碑选品怎么获得权限
      • ¥15 R语言 回归树/袋装树/随机森林预测