|
|
@@ -1,8 +1,8 @@
|
|
|
#!/bin/bash
|
|
|
# info: add cron job for hestia autoupdates
|
|
|
-# options: NONE
|
|
|
+# options: MODE
|
|
|
#
|
|
|
-# The function adds cronjob for hestia autoupdate.
|
|
|
+# The function adds cronjob for hestia autoupdate from apt or git.
|
|
|
|
|
|
|
|
|
#----------------------------------------------------------#
|
|
|
@@ -11,7 +11,7 @@
|
|
|
|
|
|
# Argument definition
|
|
|
user=admin
|
|
|
-
|
|
|
+mode=$1
|
|
|
# Includes
|
|
|
source $HESTIA/func/main.sh
|
|
|
source $HESTIA/conf/hestia.conf
|
|
|
@@ -43,12 +43,24 @@ time=$(echo "$time_n_date" |cut -f 1 -d \ )
|
|
|
date=$(echo "$time_n_date" |cut -f 2 -d \ )
|
|
|
|
|
|
# Define time somewhere at night
|
|
|
-min=$(generate_password '012345' '2')
|
|
|
-hour=$(generate_password '1234567' '1')
|
|
|
-day='*'
|
|
|
-month='*'
|
|
|
-wday='*'
|
|
|
-command='sudo /usr/local/hestia/bin/v-update-sys-hestia-all'
|
|
|
+
|
|
|
+
|
|
|
+if [ -z "$mode" ] || [ "$mode" = "apt" ]; then
|
|
|
+ min=$(generate_password '012345' '2')
|
|
|
+ hour=$(generate_password '1234567' '1')
|
|
|
+ day='*'
|
|
|
+ month='*'
|
|
|
+ wday='*'
|
|
|
+ command='sudo /usr/local/hestia/bin/v-update-sys-hestia-all'
|
|
|
+fi
|
|
|
+if [ "$mode" = "git" ]; then
|
|
|
+ min='0'
|
|
|
+ hour='0'
|
|
|
+ day='*'
|
|
|
+ month='*'
|
|
|
+ wday='*'
|
|
|
+ command='sudo /usr/local/hestia/bin/v-update-sys-hestia-git'
|
|
|
+fi
|
|
|
|
|
|
# Concatenating cron string
|
|
|
str="JOB='$job' MIN='$min' HOUR='$hour' DAY='$day' MONTH='$month' WDAY='$wday'"
|