droboports / nfs

NFS Server DroboApp build scripts
GNU General Public License v2.0
10 stars 3 forks source link

[DroboFS] pgrep doesn't exist #3

Closed coolacid closed 9 years ago

coolacid commented 9 years ago

Line 51 of service.sh calls for pgrep, this doesn't exist on the DroboFS.

The following will give the same results:

/bin/ps w | /bin/grep [n]fsd > /dev/null

ricardopadilha commented 9 years ago

Currently my FS is offline, so could you please explain why the [n] in the regex? As far as I remember the module lists itself as nfsd, right? A simpler version would be:

/bin/ps w | /bin/grep -q nfsd

Could you please also try:

killall -0 nfsd; echo $?

And see if it returns 1 if nfsd is not running, and 0 when it is?

coolacid commented 9 years ago

the grep nfsd will match its self. Since nfsd will show up in the results at least with grep. Doing [n]fsd makes it match nfsd the app, but since you now have [n]fsd as the grep argument it can't match that. (Sorry if that's not coherent, just got morning coffee"

The second option seems to return 1 if the process doesn't exist, and 0 if it does as well. (Tested against rpc.mountd since I don't have an nfsd process yet)

ricardopadilha commented 9 years ago

the grep nfsd will match its self.

Ahh, good point. I was looking at earlier versions of service.sh and I noticed that I used some variant of that at some point. It was probably abandoned for that very reason.

The second option seems to return 1 if the process doesn't exist, and 0 if it does as well. (Tested against rpc.mountd since I don't have an nfsd process yet)

Yeah, in theory it should work. I'm not entirely sure why I did not use that version in the 5N branch as well. Let me check and I'll get back to you.

ricardopadilha commented 9 years ago

I switched both branches (5N and FS) to killall. It seems like a more elegant approach.