657
657
local usage=" USAGE: wb nomad ${op} ${subop} SERVER-NAME"
658
658
local name=${1:? $usage } ; shift
659
659
local config_file=$( wb_nomad server config-file-path " ${name} " )
660
- pgrep --delimiter ' ' --full " nomad.*${config_file} .*"
660
+ # Make it Mac compatible by only using shorthand options:
661
+ # `-d` instead of `--delimiter` and `-f` instead of `--full`
662
+ pgrep -d ' ' -f " nomad.*${config_file} .*"
661
663
# Clean up is only done by the `stop` subcommand!
662
664
# No `rm "${pid_file}"` if not running.
663
665
;;
668
670
local pid_file=$( wb_nomad server pid-filepath " ${name} " )
669
671
local config_file=$( wb_nomad server config-file-path " ${name} " )
670
672
# It's running if we haven't PROPERLY stopped it or PIDs exist!
671
- test -f " ${pid_file} " || test $( pgrep --count --full " nomad.*${config_file} .*" ) -gt 0
673
+ # `pgrep` piped to `wc -l` instead "--count" to make it Mac comptible
674
+ # Also only shorthand options: like `-f` instead of `--full`
675
+ test -f " ${pid_file} " || test $( pgrep -f " nomad.*${config_file} .*" | wc -l) -gt 0
672
676
;;
673
677
# ###### server -> start )#######################################################
674
678
start )
879
883
local usage=" USAGE: wb nomad ${op} ${subop} CLIENT-NAME"
880
884
local name=${1:? $usage } ; shift
881
885
local config_file=$( wb_nomad client config-file-path " ${name} " )
882
- pgrep --delimiter ' ' --full " nomad.*${config_file} .*"
886
+ # Make it Mac compatible by only using shorthand options:
887
+ # `-d` instead of `--delimiter` and `-f` instead of `--full`
888
+ pgrep -d ' ' -f " nomad.*${config_file} .*"
883
889
# Clean up is only done by the `stop` subcommand!
884
890
# No `rm "${pid_file}"` if not running.
885
891
;;
890
896
local pid_file=$( wb_nomad client pid-filepath " ${name} " )
891
897
local config_file=$( wb_nomad client config-file-path " ${name} " )
892
898
# It's running if we haven't PROPERLY stopped it or PIDs exist!
893
- test -f " ${pid_file} " || test $( pgrep --count --full " nomad.*${config_file} .*" ) -gt 0
899
+ # `pgrep` piped to `wc -l` instead "--count" to make it Mac comptible
900
+ # Also only shorthand options: like `-f` instead of `--full`
901
+ test -f " ${pid_file} " || test $( pgrep -f " nomad.*${config_file} .*" | wc -l) -gt 0
894
902
;;
895
903
# ###### client -> start )#######################################################
896
904
# Agent is started with `-network-interface lo` if not without a proper
@@ -1317,7 +1325,9 @@ EOF
1317
1325
pids-array )
1318
1326
local usage=" USAGE: wb nomad ${op} ${subop} "
1319
1327
local state_dir=$( wb_nomad webfs state-dir-path)
1320
- pgrep --delimiter ' ' --full " webfsd.*${state_dir} " /webfsd.log
1328
+ # Make it Mac compatible by only using shorthand options:
1329
+ # `-d` instead of `--delimiter` and `-f` instead of `--full`
1330
+ pgrep -d ' ' -f " webfsd.*${state_dir} " /webfsd.log
1321
1331
# Clean up is only done by the `stop` subcommand!
1322
1332
# No `rm "${pid_file}"` if not running.
1323
1333
;;
@@ -1326,7 +1336,9 @@ EOF
1326
1336
local pid_file=$( wb_nomad webfs pid-filepath)
1327
1337
local state_dir=$( wb_nomad webfs state-dir-path)
1328
1338
# It's running if we haven't PROPERLY stopped it or PIDs exist!
1329
- test -f " ${pid_file} " && test $( pgrep --count --full " webfsd.*${state_dir} " /webfsd.log) -gt 0
1339
+ # `pgrep` piped to `wc -l` instead "--count" to make it Mac comptible
1340
+ # Also only shorthand options: like `-f` instead of `--full`
1341
+ test -f " ${pid_file} " && test $( pgrep -f " webfsd.*${state_dir} " /webfsd.log | wc -l) -gt 0
1330
1342
;;
1331
1343
start )
1332
1344
local usage=" USAGE: wb nomad ${op} ${subop} "
0 commit comments