From 8da9299ee6bbdeba2578e03a9e19ca969e5f8adf Mon Sep 17 00:00:00 2001 From: sang Date: Thu, 5 Dec 2024 11:57:38 +0800 Subject: [PATCH] feat: Init check time at first --- lxc-iptag | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/lxc-iptag b/lxc-iptag index 9f0e103..93880e4 100755 --- a/lxc-iptag +++ b/lxc-iptag @@ -131,6 +131,13 @@ update_lxc_iptags() { done } +init() { + current_time=$(date +%s) + last_lxc_status_check_time=${current_time} + last_fw_net_interface_check_time=${current_time} + last_update_time=0 +} + check() { current_time=$(date +%s) @@ -169,6 +176,7 @@ check() { # main: Set the IP tags for all LXC containers main() { + init while true; do check sleep "${LOOP_INTERVAL}"