Can you post the output from the script rather than your description
of the output?
That is, can you wrap your script in this and run it:
true && ( set -x
# insert your script here
) >& output.txt
and post the contents of output.txt. Here's what I mean:
true && ( set -x
LIST = 'ypcat hosts|| sort | awk '{print $2}''
for Devices in $LIST
do
Errorcount=`snmpget -v1 -c privator $Devices snmpInBadCommunityNames.O
|awk '{print $4}' `
if [ Errorcount > 0 ]; then
Devices=$Errorcount
echo $Devices
# line added
echo "$sysdate $Devices" >> /tmp/hosthistory.txt
fi
done
) >& output.txt
When I run the above this is was I get for the contents of output.txt:
$ cat output.txt
+ LIST = 'ypcat hosts|| sort | awk {print' '}'
+ /usr/bin/python /usr/lib/command-not-found -- LIST
+ return 127
-bash: LIST: command not found
Regards,
- Robert
On Mon, Oct 26, 2009 at 2:59 PM, Lemseffer. Tahar (MSA)
<[email protected]> wrote:
> Yes I have run it manually?
> The results:
> If the community name is incorrect I get:
> Timeout: no response from Device###
> If the community name is true I get:
> Error count :value
>
> That is what I want to implement
>
> Thanks
>
> -----Original Message-----
> From: [email protected]
> [mailto:[email protected]] On Behalf Of Robert Citek
> Sent: Monday, October 26, 2009 11:24 AM
> To: General Linux/UNIX discussion and help,civil and on-topic
> Subject: Re: [PLUG] shell scripting
>
> Maybe the shell script isn't the issue.
>
> Have you tried running the snmpget command manually?
>
> Regards,
> - Robert
>
>
> On Mon, Oct 26, 2009 at 1:27 PM, Lemseffer. Tahar (MSA)
> <[email protected]> wrote:
>> Great
>> But I want to be able to get an intrusion some how someone is trying
> to
>> get into the device!!!!1
> _______________________________________________
> PLUG mailing list
> [email protected]
> http://lists.pdxlinux.org/mailman/listinfo/plug
> ____________________________________________________________________________
> EMAIL DISCLAIMER:
> This email and any attachments thereto may contain private, confidential, and
> privileged material for the sole use of the intended recipient. Any review,
> copying, or distribution of this email (or any attachments thereto) by other
> than the intended recipient is strictly prohibited.
>
> If you are not the intended recipient, please contact the sender immediately
> and permanently delete the original and any copies of this email and any
> attachments thereto.
> _____________________________________________________________________________
>
> _______________________________________________
> PLUG mailing list
> [email protected]
> http://lists.pdxlinux.org/mailman/listinfo/plug
>
_______________________________________________
PLUG mailing list
[email protected]
http://lists.pdxlinux.org/mailman/listinfo/plug