Skip to content

Commit ee2dfa6

Browse files
committed
Fix autoupdate schedule
1 parent c350e86 commit ee2dfa6

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

bin/get-node-status

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,12 @@ get_account_info() {
3434
get_participation_expiration_eta() {
3535
local active_key_last_valid_round=$1
3636
local last_committed_block=$2
37+
38+
if ! [[ $1 =~ ^[0-9]+$ ]] || ! [[ $2 =~ ^[0-9]+$ ]]; then
39+
echo "Both arguments must be integers. Exiting."
40+
exit 1
41+
fi
42+
3743
local current_key_blocks_remaining=$((active_key_last_valid_round - last_committed_block))
3844
local remaining_seconds
3945
local current_timestamp
@@ -57,6 +63,12 @@ display_participation_key_information() {
5763
last_committed_block=$(get_last_committed_block)
5864

5965
active_key_last_valid_round=$(docker exec -it "${container_id}" bash -c 'goal account listpartkeys' | awk '$1=="yes" {print $6}' | tr -cd '[:digit:]')
66+
67+
if [[ -z "${active_key_last_valid_round}" ]]; then
68+
echo "Participation status: No active participation key found."
69+
return 1
70+
fi
71+
6072
existing_expiration_date=$(get_participation_expiration_eta "${active_key_last_valid_round}" "${last_committed_block}")
6173

6274
echo "Participation status: $(docker exec -it "${container_id}" bash -c 'goal account dump -a '"${account_address}"' | jq -r '\''if (.onl == 1) then "online" else "offline" end'\''')"

install.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -794,7 +794,7 @@ add_update_jitter() {
794794
# Generate a random number between 0 and 2, and add +1 to shift the range to 1-3
795795
random_hour=$(( RANDOM % 3 + 1 ))
796796

797-
new_cron_schedule="swarm.cronjob.schedule=${random_minute} */${random_hour} * * *"
797+
new_cron_schedule="${random_minute} */${random_hour} * * *"
798798
sed -i -E "s|(swarm.cronjob.schedule=).*|\1${new_cron_schedule}|" "${schedule_filename}"
799799
}
800800

0 commit comments

Comments
 (0)