I want to shell execute a script through SNMP command.So for that script i have configured OID in snmpd.conf under /etc/snmp folder.
My script looks like working is just to redirect "text" to output.txt file and then print script executed on console.
#!/usr/bin/ksh
Input_path="$HOME/input.txt"
Out_Path="$HOME/output.txt"
#I have to take the line_num from output.txt which is actually number of line present in output.txt
line_num=`wc -l <$out`
#after that i need to take that line from INPUT file
line=`head -$a $Input_path | tail -1 `
#i need to uppend data to 1 kb for that i am using typset command
typeset -L1024 line
#I am increasing value of a
a=`expr $a + 1`
#same i am echo in file so at this point number of line in file will increase by 1
echo $a >> $Out_Path
#this is the final output which i want .
echo -e "$line\n"
Output
if i am using snmpwalkcommand from node ...1
snmpwalk command the output is
a
and the updated output.txt file is 1 2
snmpwalk command the output is
c
and the updated output.txt file is 1 2 3 4
snmpwalk command the output is
c
and the updated output.txt file is 1 2 3 4 5
Which means i am getting a,c,e ... but i need a,b,c,d,e
This type of processing i am doing because data is more that 1 kb in output.txt and i am not able to fetch more than 1 kb record in snmpget command, that's why i am doing this process to get whole data.