X-Git-Url: https://git.adam-barratt.org.uk/?a=blobdiff_plain;ds=sidebyside;f=modules%2Fbacula%2Ffiles%2Fbacula-idle-restart;fp=modules%2Fbacula%2Ffiles%2Fbacula-idle-restart;h=0000000000000000000000000000000000000000;hb=7731d83d098545119ac64acfb9d595a7abc2abea;hp=2f331aaae1e105757a14cb13be22e2c1d30c2e1a;hpb=2930ccd62026a0318e140ded45afdcc79c629407;p=mirror%2Fdsa-puppet.git diff --git a/modules/bacula/files/bacula-idle-restart b/modules/bacula/files/bacula-idle-restart deleted file mode 100644 index 2f331aaae..000000000 --- a/modules/bacula/files/bacula-idle-restart +++ /dev/null @@ -1,42 +0,0 @@ -#! /bin/sh -e - -# Written by Tollef Fog Heen -# Based on code by Peter Palfrader -# -# Restart the given bacula director when it's idle. -# -# XXX: Add locking - -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 -fi - -# chk_net -# returns true (0) if there are connections to that port. -chk_net() { - local port="$1"; shift - local con="$(ss -nt "sport = :$port" | wc -l)" - if [ "$con" -gt 1 ]; then - return 0 - else - return 1 - fi -} - -while chk_net "$PORT"; do - sleep 5 -done - -service $DIR restart