On 24.08.2012 02:14, Jack Stone wrote:
Thanks, I tried that but pgrep only displayed the PIDs. I guess I wasn't using proper switches.
Yes - and this should be enough. If pgrep returns PIDs - then this is the same as 'true' in your 'if' condition - if it returns nothing, the 'else' part is executed:
#!/bin/sh # * example for Jack with amavisd instead of apache # * the ^ means 'match from the beginning' # * so your content for PROCESS_PATTERN would be # PROCESS_PATTERN="^/usr/local/sbin/httpd" # because ps -ax would show you this in the # COMMAND row PROCESS_PATTERN="^/usr/local/sbin/amavisd" PGREP="/bin/pgrep" if ${PGREP} -q -j none -f ^${PROCESS_PATTERN}; then echo -e "OK" else echo -e "FAIL" fi hth, Frank Reppin -- 43rd Law of Computing: Anything that can go wr fortune: Segmentation violation -- Core dumped _______________________________________________ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to "freebsd-questions-unsubscr...@freebsd.org"