LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (http://www.linuxquestions.org/questions/programming-9/)
-   -   rpcinfo script (http://www.linuxquestions.org/questions/programming-9/rpcinfo-script-149880/)

Ljohan 02-24-2004 05:14 AM

rpcinfo script
 
I have made the following script to target all the computers that ar listed in a input file and check if mountd is running true a rpcinfo request. Using this script I can check if users ar making mountd available to the network what is not the company rule.

This code is working buth there are some things that do not work and do not apply to the rule.

This are the things I like to add buth I have no clue how this should be done.

1)
I like to check first if RPC is running or not and do this in a defined time that I can set. Something like wait fore 2 sec before skipping the computer and go to the next.

2)
If RPC is running than do the check "rpcinfo -p $line |grep mountd"

3)
and then if mountd is runnig a output of "showmount -e $line" because there ar some computers that are allowd to run distribution mounts to be accesd by the rest of the network.

What I like to know is how I can make a "if then" like statement based on the returning results. Anybody can help me with this problem?


Code:

#!/bin/sh
# show RPC results from list op IP's

echo "    Enter target input file:"
read inputfile


exec<$inputfile
  while read line
  do
    echo '  Checking : '$line
      rpcinfo -p $line |grep mountd
    echo
  done

Thanks already,
suntac

ToniT 04-24-2004 06:39 PM

Code:

if /bin/false 'False is a program that ignores all parameters like this and fails' ; then
  echo 'This command succseeded'
else
  echo 'This program failed'
fi

if /bin/true 'True is similar to false, but it does not fail. Replace your own program here' ; then
  echo 'This command succseeded'
else
  echo 'This program failed'
fi



All times are GMT -5. The time now is 06:02 PM.