X-Git-Url: https://git.adam-barratt.org.uk/?a=blobdiff_plain;f=modules%2Fbacula%2Ffiles%2Fbacula-idle-restart;h=cebce07eb58080e2a5ba36066b714bd829f8a8c5;hb=598ef097f4c8f6b50b61dde7fc4bd011e955b754;hp=2f331aaae1e105757a14cb13be22e2c1d30c2e1a;hpb=a5ffcf93be9b9c03cb2cb20ddcfbfd32b56a8634;p=mirror%2Fdsa-puppet.git diff --git a/modules/bacula/files/bacula-idle-restart b/modules/bacula/files/bacula-idle-restart index 2f331aaae..cebce07eb 100644 --- a/modules/bacula/files/bacula-idle-restart +++ b/modules/bacula/files/bacula-idle-restart @@ -9,20 +9,15 @@ set -e -if [ "$1" = "fd" ];then - PORT=9102 - DIR="bacula-fd" -elif [ "$1" = "sd" ]; then - PORT=9103 - DIR="bacula-sd" -else - # Usage - echo "$0 [fd|sd]" - echo - echo "Restart bacula fd or sd when idle" - exit 1 +if [ "$#" != 2 ];then + echo >&2 "$0 " + echo "Restart bacula service when port idle" + exit 1 fi +PORT="$1" +SERVICE="$2" + # chk_net # returns true (0) if there are connections to that port. chk_net() { @@ -39,4 +34,4 @@ while chk_net "$PORT"; do sleep 5 done -service $DIR restart +service $SERVICE restart