Operating System - Tru64 Unix
1748117 Members
3737 Online
108758 Solutions
New Discussion юеВ

Re: mountd is running option -n

 
SOLVED
Go to solution
sammer
Advisor

mountd is running option -n

Hi,

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"




6 REPLIES 6
Rob Leadbeater
Honored Contributor

Re: mountd is running option -n

Hi,

You could just use two grep statements...

$ ps -aef | grep mountd | grep "\-n"

Cheers,

Rob
Steven Schweda
Honored Contributor
Solution

Re: mountd is running option -n

Perhaps something like:

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.
Dennis Handly
Acclaimed Contributor

Re: mountd is running option -n

>Rob: $ ps -aef | grep mountd | grep "\-n"

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.
sammer
Advisor

Re: mountd is running option -n

Thanks Steve...

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..


Thanks,
Shammer.
Steven Schweda
Honored Contributor

Re: mountd is running option -n

> I found one more solution.

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
real world.

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.
sammer
Advisor

Re: mountd is running option -n

You are absolutely right..

Thanks..