fixed process grepping fact for scaleio_state.rb #1
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
'ps auxw | grep mdm | egrep -v "bash|grep mdm"'
might give a false positive if your hostname contains “mdm” and any of your interfaces are mistakenly set as DHCP, as is the case in a Vagrant environment:
[vagrant@mdm1 ~]$ ps auxw | grep mdm | egrep -v "bash|grep mdm"
root 841 0.0 0.0 9120 124 ? Ss 15:37 0:00 /sbin/dhclient -H mdm1 -1 -q -cf /etc/dhcp/dhclient-eth0.conf -lf /var/lib/dhclient/dhclient-eth0.leases -pf /var/run/dhclient-eth0.pid eth0
root 2209 4.3 57.4 1153416 586688 ? SLl 15:37 0:03 /opt/emc/scaleio/mdm/bin/mdm-1.30.426.0 --log_dir /opt/emc/scaleio/mdm/bin/../logs --conf_file /opt/emc/scaleio/mdm/bin/../cfg/conf.txt
This means that even if the mdm process isn't running, since the fact only checks for output it will give a false positive.
With pgrep, you only get the process number, which tells you it’s running, which is what you want:
[vagrant@mdm1 ~]$ pgrep mdm
2209
[vagrant@mdm1 ~]$ pgrep sds
593