10-15-2008 02:08 AM
Please let me know how to check whether mountd is running option -n.
since mountd can also be running as
"mountd -i -n".
In that case if i issue this command
ps -aef |grep "[m]ountd -n"
i wont't get apropriate output right.
Could you Please let me know how to do that..
$ ps -aef |grep "[m]ountd *"
root 525191 524289 0.0 15:28:43 ?? 0:00.02 /usr/sbin/mountd -i
root 525826 524289 0.0 15:36:00 ?? 0:00.02 /usr/sbin/mountd -i -n
$ps -aef |grep "[m]ountd -n"
Solved! Go to Solution.
10-15-2008 06:15 AM
grep ' /usr/sbin/mountd .*-n'
"man grep". Look for "regular expression".
White space around "/usr/sbin/mountd" helps
to avoid false matches.
If you wish to get more creative, "grep -E"
(egrep) can do even more.
10-15-2008 05:02 PM
Hmm, I would have expected this last grep not to work. I.e. quotes and backslash removed by the shell, unless in ''.
It works but it may be safer to use: grep -e -n
Or of course Steven's is better.
10-15-2008 10:14 PM
I found one more solution.
Please look at it..
ps -ef | grep mountd | grep -w "\-\n" |grep -v grep
$ ps -ef | grep mountd | grep -w "\-\n" |grep -v grep
root 534225 524289 0.0 11:44:04 ?? 0:00.01 /usr/sbin/mountd -i -n
This also works right..
10-15-2008 11:14 PM
There's seldom only one solution to any
programming problem. The optimal solution
probably doesn't require running grep three
times, but you might never notice the extra
work. Getting the right answer is normally
more important than maximizing efficiency,
but doing both is even better.
> $ ps -ef | grep mountd [...]
You'd better hope that no one runs a program
named "I_am_not_the_real_mountd_program" (or
any number of other possibilities).
Some apparently right answers will fail
sooner than others when they get out to the
urtx# ps -ef | grep mountd
root 293292 1409 0.0 02:09:58 pts/3 0:00.01 I am not the real mountd program.sh -n
Many things are possible.