Infinite loop
This commit is contained in:
parent
8712595939
commit
ca686dd582
@ -49,24 +49,9 @@ function main() {
|
|||||||
case "$1" in
|
case "$1" in
|
||||||
start)
|
start)
|
||||||
update-ufw-rules
|
update-ufw-rules
|
||||||
docker events --format '{{.Time}} {{.Status}} {{.Actor.Attributes.name}}' --filter 'scope=local' --filter 'type=container' |
|
while true; do
|
||||||
while read time status name; do
|
sleep "$(( 3600 * 24 * 7 ))" || break
|
||||||
echo "$time $status $name" >&2
|
|
||||||
[[ -z "$name" ]] && continue
|
|
||||||
|
|
||||||
[[ "$status" = @(kill|start) ]] || continue
|
|
||||||
|
|
||||||
declare -n env_name="ufw_public_$(get-service-id-of "$name")"
|
|
||||||
[[ -z "${env_name:-}" ]] && continue
|
|
||||||
|
|
||||||
declare port="${env_name:-deny}"
|
|
||||||
if [[ "$status" = kill ]]; then
|
|
||||||
port=deny
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo ufw-update-rule-for-instance "$name" "$port"
|
|
||||||
done
|
done
|
||||||
sleep 60; exit 1
|
|
||||||
;;
|
;;
|
||||||
delete|allow|add-service-rule)
|
delete|allow|add-service-rule)
|
||||||
ufw-docker "$@"
|
ufw-docker "$@"
|
||||||
|
Loading…
Reference in New Issue
Block a user