Skip to content

Commit 7b24518

Browse files
committed
Prevent adding duplicate restart jobs in queue
1 parent d997100 commit 7b24518

File tree

7 files changed

+14
-35
lines changed

7 files changed

+14
-35
lines changed

bin/v-restart-cron

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,8 @@ if [ "$1" = "no" ]; then
3636
fi
3737

3838
# Schedule restart
39-
if [ "$1" = 'scheduled' ]; then
40-
echo "$BIN/$SCRIPT now" >> $HESTIA/data/queue/restart.pipe
41-
exit
42-
fi
43-
if [ -z "$1" ] && [ "$SCHEDULED_RESTART" = 'yes' ]; then
39+
if [ "$1" = 'scheduled' ] || [ -z "$1" -a "$SCHEDULED_RESTART" = 'yes' ]; then
40+
sed -i "/$SCRIPT/d" $HESTIA/data/queue/restart.pipe
4441
echo "$BIN/$SCRIPT now" >> $HESTIA/data/queue/restart.pipe
4542
exit
4643
fi

bin/v-restart-dns

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,11 +41,8 @@ if [ "$1" = "no" ]; then
4141
fi
4242

4343
# Schedule restart
44-
if [ "$1" = 'scheduled' ]; then
45-
echo "$BIN/$SCRIPT now" >> $HESTIA/data/queue/restart.pipe
46-
exit
47-
fi
48-
if [ -z "$1" ] && [ "$SCHEDULED_RESTART" = 'yes' ]; then
44+
if [ "$1" = 'scheduled' ] || [ -z "$1" -a "$SCHEDULED_RESTART" = 'yes' ]; then
45+
sed -i "/$SCRIPT/d" $HESTIA/data/queue/restart.pipe
4946
echo "$BIN/$SCRIPT now" >> $HESTIA/data/queue/restart.pipe
5047
exit
5148
fi

bin/v-restart-ftp

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,8 @@ if [ "$1" = "no" ]; then
3636
fi
3737

3838
# Schedule restart
39-
if [ "$1" = 'scheduled' ]; then
40-
echo "$BIN/$SCRIPT now" >> $HESTIA/data/queue/restart.pipe
41-
exit
42-
fi
43-
if [ -z "$1" ] && [ "$SCHEDULED_RESTART" = 'yes' ]; then
39+
if [ "$1" = 'scheduled' ] || [ -z "$1" -a "$SCHEDULED_RESTART" = 'yes' ]; then
40+
sed -i "/$SCRIPT/d" $HESTIA/data/queue/restart.pipe
4441
echo "$BIN/$SCRIPT now" >> $HESTIA/data/queue/restart.pipe
4542
exit
4643
fi

bin/v-restart-mail

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,8 @@ if [ "$1" = "no" ]; then
3636
fi
3737

3838
# Schedule restart
39-
if [ "$1" = 'scheduled' ]; then
40-
echo "$BIN/$SCRIPT now" >> $HESTIA/data/queue/restart.pipe
41-
exit
42-
fi
43-
if [ -z "$1" ] && [ "$SCHEDULED_RESTART" = 'yes' ]; then
39+
if [ "$1" = 'scheduled' ] || [ -z "$1" -a "$SCHEDULED_RESTART" = 'yes' ]; then
40+
sed -i "/$SCRIPT/d" $HESTIA/data/queue/restart.pipe
4441
echo "$BIN/$SCRIPT now" >> $HESTIA/data/queue/restart.pipe
4542
exit
4643
fi

bin/v-restart-proxy

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,8 @@ if [ "$1" = "no" ]; then
3636
fi
3737

3838
# Schedule restart
39-
if [ "$1" = 'scheduled' ]; then
40-
echo "$BIN/$SCRIPT now" >> $HESTIA/data/queue/restart.pipe
41-
exit
42-
fi
43-
if [ -z "$1" ] && [ "$SCHEDULED_RESTART" = 'yes' ]; then
39+
if [ "$1" = 'scheduled' ] || [ -z "$1" -a "$SCHEDULED_RESTART" = 'yes' ]; then
40+
sed -i "/$SCRIPT/d" $HESTIA/data/queue/restart.pipe
4441
echo "$BIN/$SCRIPT now" >> $HESTIA/data/queue/restart.pipe
4542
exit
4643
fi

bin/v-restart-web

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,8 @@ if [ "$1" = "no" ]; then
3636
fi
3737

3838
# Schedule restart
39-
if [ "$1" = 'scheduled' ]; then
40-
echo "$BIN/$SCRIPT now" >> $HESTIA/data/queue/restart.pipe
41-
exit
42-
fi
43-
if [ -z "$1" ] && [ "$SCHEDULED_RESTART" = 'yes' ]; then
39+
if [ "$1" = 'scheduled' ] || [ -z "$1" -a "$SCHEDULED_RESTART" = 'yes' ]; then
40+
sed -i "/$SCRIPT/d" $HESTIA/data/queue/restart.pipe
4441
echo "$BIN/$SCRIPT now" >> $HESTIA/data/queue/restart.pipe
4542
exit
4643
fi

bin/v-restart-web-backend

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,8 @@ if [ "$1" = "no" ]; then
3636
fi
3737

3838
# Schedule restart
39-
if [ "$1" = 'scheduled' ]; then
40-
echo "$BIN/$SCRIPT now" >> $HESTIA/data/queue/restart.pipe
41-
exit
42-
fi
43-
if [ -z "$1" ] && [ "$SCHEDULED_RESTART" = 'yes' ]; then
39+
if [ "$1" = 'scheduled' ] || [ -z "$1" -a "$SCHEDULED_RESTART" = 'yes' ]; then
40+
sed -i "/$SCRIPT/d" $HESTIA/data/queue/restart.pipe
4441
echo "$BIN/$SCRIPT now" >> $HESTIA/data/queue/restart.pipe
4542
exit
4643
fi

0 commit comments

Comments
 (0)