3 # Written by Tollef Fog Heen <tfheen@err.no>
4 # Based on code by Peter Palfrader
6 # Restart the given bacula director when it's idle.
13 echo >&2 "$0 <port> <service>"
14 echo "Restart bacula service when port idle"
22 # returns true (0) if there are connections to that port.
24 local port="$1"; shift
25 local con="$(ss -nt "sport = :$port" | wc -l)"
26 if [ "$con" -gt 1 ]; then
33 while chk_net "$PORT"; do
37 service $SERVICE restart