From 6a6c1634eb05484e4246c8bba14c03f7cc3b73c5 Mon Sep 17 00:00:00 2001 From: Mike McCune Date: Thu, 23 Jan 2020 09:29:32 -0800 Subject: [PATCH] Don't error out if foreman-maintain isn't installed. (#54) This is useful for pre-testing on a host without Satellite --- storage-benchmark | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/storage-benchmark b/storage-benchmark index 92ad78c..2ecc6a1 100755 --- a/storage-benchmark +++ b/storage-benchmark @@ -114,7 +114,6 @@ then fi fi - echo "" echo "**** WARNING! We recommend you stop all Satellite 6 services to ensure no " echo "interruption to critical processes." @@ -124,20 +123,28 @@ echo "Do you wish to stop Satellite 6 services? (Y/N) " read STOPSERVICES if [[ $STOPSERVICES =~ ^[Yy]$ ]] then - echo "" - echo "Stopping services." - echo "" - foreman-maintain service stop + if ! [ -x "$(command -v foreman-maintain)" ]; then + echo "foreman-maintain not installed. Continuing." + else + echo "" + echo "Stopping services." + echo "" + foreman-maintain service stop + fi fi testlocation if [[ $STOPSERVICES =~ ^[Yy]$ ]] then - echo "" - echo "Starting services." - echo "" - foreman-maintain service start + if ! [ -x "$(command -v foreman-maintain)" ]; then + echo "foreman-maintain not installed. Continuing." + else + echo "" + echo "Starting services." + echo "" + foreman-maintain service start + fi fi echo "Finished."