开发者

snmp service can't run correctly my program .. in linux

I have developed this script program : (program name is x1)

#!/bin/bash
/usr/bin/top -n 1 >/tmp/top1.log
echo ok

Next is the command that I run it on terminal and get 开发者_开发问答correct reply:

./x1

meaning that when external command of top -n 1>tmp/top1.log is written in the file top1.log and then the message ok printed in output!

But, if I config the snmpd.cof and the program is run by snmp service:

snmpwalk -v2c -c public 127.0.0.0    OID

The external command of top -n 1>/tmp/top1.log will not be placed in top1.log and the file top1.log will not be generated, only the message ok is printed in the output.

In fact, top -n 1>/tmp/top1.log command cannot run by SNMP service.


my snmpd.conf :

syslocation Server Room
syscontact Sysadmin (root@localhost)

rwcommunity public 192.168.7.165
rwcommunity public 127.0.0.1

sh  1.3.6.1.4.1.999.4.1.4  public  /tmp/x1

i used ( sh and exec ) to run !

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜