Skip to content

Commit 9ea3022

Browse files
author
Kristan Kenney
authored
Merge pull request hestiacp#508 from Lupul/dev-0708
Installer: Restart cron service in background
2 parents 2c9134e + 39af721 commit 9ea3022

File tree

10 files changed

+25
-42
lines changed

10 files changed

+25
-42
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

install/hst-install-debian.sh

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1792,6 +1792,11 @@ $HESTIA/bin/v-add-web-domain admin $servername
17921792
check_result $? "can't create $servername domain"
17931793

17941794
# Adding cron jobs
1795+
export SCHEDULED_RESTART="yes"
1796+
command="sudo $HESTIA/bin/v-update-sys-queue restart"
1797+
$HESTIA/bin/v-add-cron-job 'admin' '*/2' '*' '*' '*' '*' "$command"
1798+
systemctl restart cron
1799+
17951800
command="sudo $HESTIA/bin/v-update-sys-queue disk"
17961801
$HESTIA/bin/v-add-cron-job 'admin' '15' '02' '*' '*' '*' "$command"
17971802
command="sudo $HESTIA/bin/v-update-sys-queue traffic"
@@ -1800,8 +1805,6 @@ command="sudo $HESTIA/bin/v-update-sys-queue webstats"
18001805
$HESTIA/bin/v-add-cron-job 'admin' '30' '03' '*' '*' '*' "$command"
18011806
command="sudo $HESTIA/bin/v-update-sys-queue backup"
18021807
$HESTIA/bin/v-add-cron-job 'admin' '*/5' '*' '*' '*' '*' "$command"
1803-
command="sudo $HESTIA/bin/v-update-sys-queue restart"
1804-
$HESTIA/bin/v-add-cron-job 'admin' '*/2' '*' '*' '*' '*' "$command"
18051808
command="sudo $HESTIA/bin/v-backup-users"
18061809
$HESTIA/bin/v-add-cron-job 'admin' '10' '05' '*' '*' '*' "$command"
18071810
command="sudo $HESTIA/bin/v-update-user-stats"
@@ -1811,7 +1814,6 @@ $HESTIA/bin/v-add-cron-job 'admin' '*/5' '*' '*' '*' '*' "$command"
18111814

18121815
# Enable automatic updates
18131816
$HESTIA/bin/v-add-cron-hestia-autoupdate
1814-
systemctl restart cron
18151817

18161818
# Building initital rrd images
18171819
$HESTIA/bin/v-update-sys-rrd

install/hst-install-ubuntu.sh

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1679,6 +1679,11 @@ $HESTIA/bin/v-add-web-domain admin $servername
16791679
check_result $? "can't create $servername domain"
16801680

16811681
# Adding cron jobs
1682+
export SCHEDULED_RESTART="yes"
1683+
command="sudo $HESTIA/bin/v-update-sys-queue restart"
1684+
$HESTIA/bin/v-add-cron-job 'admin' '*/2' '*' '*' '*' '*' "$command"
1685+
systemctl restart cron
1686+
16821687
command="sudo $HESTIA/bin/v-update-sys-queue disk"
16831688
$HESTIA/bin/v-add-cron-job 'admin' '15' '02' '*' '*' '*' "$command"
16841689
command="sudo $HESTIA/bin/v-update-sys-queue traffic"
@@ -1687,8 +1692,6 @@ command="sudo $HESTIA/bin/v-update-sys-queue webstats"
16871692
$HESTIA/bin/v-add-cron-job 'admin' '30' '03' '*' '*' '*' "$command"
16881693
command="sudo $HESTIA/bin/v-update-sys-queue backup"
16891694
$HESTIA/bin/v-add-cron-job 'admin' '*/5' '*' '*' '*' '*' "$command"
1690-
command="sudo $HESTIA/bin/v-update-sys-queue restart"
1691-
$HESTIA/bin/v-add-cron-job 'admin' '*/2' '*' '*' '*' '*' "$command"
16921695
command="sudo $HESTIA/bin/v-backup-users"
16931696
$HESTIA/bin/v-add-cron-job 'admin' '10' '05' '*' '*' '*' "$command"
16941697
command="sudo $HESTIA/bin/v-update-user-stats"
@@ -1698,7 +1701,6 @@ $HESTIA/bin/v-add-cron-job 'admin' '*/5' '*' '*' '*' '*' "$command"
16981701

16991702
# Enable automatic updates
17001703
$HESTIA/bin/v-add-cron-hestia-autoupdate
1701-
systemctl restart cron
17021704

17031705
# Building initital rrd images
17041706
$HESTIA/bin/v-update-sys-rrd

install/upgrade/versions/latest.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ if [ ! -z "$IMAP_SYSTEM" ]; then
3636
fi
3737
fi
3838

39-
if [ -z "$(v-list-cron-jobs admin | grep 'v-update-sys-queue backup')" ]; then
39+
if [ -z "$($BIN/v-list-cron-jobs admin | grep 'v-update-sys-queue restart')" ]; then
4040
command="sudo $BIN/v-update-sys-queue restart"
4141
$BIN/v-add-cron-job 'admin' '*/2' '*' '*' '*' '*' "$command"
4242
fi

0 commit comments

Comments
 (0)