Re: mountd is running option -n (449 Views)
Reply
Advisor
sammer
Posts: 24
Registered: ‎10-12-2008
Message 1 of 7 (449 Views)
Accepted Solution

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"




Honored Contributor
Rob Leadbeater
Posts: 3,582
Registered: ‎08-14-2002
Message 2 of 7 (449 Views)

Re: mountd is running option -n

Hi,

You could just use two grep statements...

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

Cheers,

Rob
Honored Contributor
Steven Schweda
Posts: 9,096
Registered: ‎02-23-2005
Message 3 of 7 (449 Views)

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.
Acclaimed Contributor
Dennis Handly
Posts: 25,274
Registered: ‎03-06-2006
Message 4 of 7 (449 Views)

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.
Advisor
sammer
Posts: 24
Registered: ‎10-12-2008
Message 5 of 7 (449 Views)

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.
Honored Contributor
Steven Schweda
Posts: 9,096
Registered: ‎02-23-2005
Message 6 of 7 (449 Views)

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.
Advisor
sammer
Posts: 24
Registered: ‎10-12-2008
Message 7 of 7 (449 Views)

Re: mountd is running option -n

You are absolutely right..

Thanks..
The opinions expressed above are the personal opinions of the authors, not of HP. By using this site, you accept the Terms of Use and Rules of Participation.