projects
/
mirror
/
dsa-puppet.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Also collect entries that only knew the port
[mirror/dsa-puppet.git]
/
modules
/
bacula
/
files
/
bacula-idle-restart
diff --git
a/modules/bacula/files/bacula-idle-restart
b/modules/bacula/files/bacula-idle-restart
index
2f331aa
..
cebce07
100644
(file)
--- a/
modules/bacula/files/bacula-idle-restart
+++ b/
modules/bacula/files/bacula-idle-restart
@@
-9,20
+9,15
@@
set -e
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 <port> <service>"
+ echo "Restart bacula service when port idle"
+ exit 1
fi
fi
+PORT="$1"
+SERVICE="$2"
+
# chk_net <port>
# returns true (0) if there are connections to that port.
chk_net() {
# chk_net <port>
# returns true (0) if there are connections to that port.
chk_net() {
@@
-39,4
+34,4
@@
while chk_net "$PORT"; do
sleep 5
done
sleep 5
done
-service $
DIR
restart
+service $
SERVICE
restart