Skip to content

Commit a539421

Browse files
author
Kristan Kenney
committed
Add delay to service restart to prevent rate-limit issues
1 parent 34db3fd commit a539421

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

bin/v-restart-service

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ service_status=$(pgrep $service)
2929
# Action #
3030
#----------------------------------------------------------#
3131

32+
# Restart service if not running instead of trying to reload
3233
if [ -z "$service_status" ]; then
3334
force="yes"
3435
fi
@@ -48,8 +49,10 @@ elif [ -z "$force" -o "$force" = "no" ] && [ \
4849
"$service" = "proftpd" -o \
4950
"$service" = "ssh" -o \
5051
"$service" = "fail2ban" ]; then
52+
sleep 1
5153
systemctl reload $service > /dev/null 2>&1
5254
else
55+
sleep 1
5356
systemctl restart $service > /dev/null 2>&1
5457
fi
5558

0 commit comments

Comments
 (0)