Skip to content

Commit 6f4f550

Browse files
author
Kristan Kenney
committed
Enable automatic updates from Git via CLI
1 parent b9b6677 commit 6f4f550

File tree

2 files changed

+23
-10
lines changed

2 files changed

+23
-10
lines changed

bin/v-add-cron-hestia-autoupdate

Lines changed: 21 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
#!/bin/bash
22
# info: add cron job for hestia autoupdates
3-
# options: NONE
3+
# options: MODE
44
#
5-
# The function adds cronjob for hestia autoupdate.
5+
# The function adds cronjob for hestia autoupdate from apt or git.
66

77

88
#----------------------------------------------------------#
@@ -11,7 +11,7 @@
1111

1212
# Argument definition
1313
user=admin
14-
14+
mode=$1
1515
# Includes
1616
source $HESTIA/func/main.sh
1717
source $HESTIA/conf/hestia.conf
@@ -43,12 +43,24 @@ time=$(echo "$time_n_date" |cut -f 1 -d \ )
4343
date=$(echo "$time_n_date" |cut -f 2 -d \ )
4444

4545
# Define time somewhere at night
46-
min=$(generate_password '012345' '2')
47-
hour=$(generate_password '1234567' '1')
48-
day='*'
49-
month='*'
50-
wday='*'
51-
command='sudo /usr/local/hestia/bin/v-update-sys-hestia-all'
46+
47+
48+
if [ -z "$mode" ] || [ "$mode" = "apt" ]; then
49+
min=$(generate_password '012345' '2')
50+
hour=$(generate_password '1234567' '1')
51+
day='*'
52+
month='*'
53+
wday='*'
54+
command='sudo /usr/local/hestia/bin/v-update-sys-hestia-all'
55+
fi
56+
if [ "$mode" = "git" ]; then
57+
min='0'
58+
hour='0'
59+
day='*'
60+
month='*'
61+
wday='*'
62+
command='sudo /usr/local/hestia/bin/v-update-sys-hestia-git'
63+
fi
5264

5365
# Concatenating cron string
5466
str="JOB='$job' MIN='$min' HOUR='$hour' DAY='$day' MONTH='$month' WDAY='$wday'"

bin/v-update-sys-hestia-git

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
# - Will download from the hestiacp repository
88
# - Pulls code from staging/beta branch
99
# - install: installs package immediately
10+
# - install-auto: installs package and schedules automatic updates from Git
1011
# - 'all': (optional) - compiles nginx and php alongside panel.
1112
# this option takes a long time, only use when needed
1213

@@ -421,7 +422,7 @@ install_build() {
421422

422423
# Define installation routine
423424

424-
if [ "$install" = "install" ] || [ "$install" = "yes" ]; then
425+
if [ "$install" = "install" ] || [ "$install" = "yes" ] || [ "$install" = "install-auto" ]; then
425426
install_build
426427
else
427428
warning_message

0 commit comments

Comments
 (0)