Skip to content

Commit 11874f6

Browse files
authored
Add new autoupdate script for hestia.
1 parent 036e2c1 commit 11874f6

File tree

1 file changed

+81
-0
lines changed

1 file changed

+81
-0
lines changed

bin/v-list-sys-hestia-autoupdate

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
#!/bin/bash
2+
# info: list hestia autoupdate settings
3+
# options: [FORMAT]
4+
#
5+
# The function for obtaining autoupdate setings.
6+
7+
8+
#----------------------------------------------------------#
9+
# Variable&Function #
10+
#----------------------------------------------------------#
11+
12+
# Argument definition
13+
user='admin'
14+
format=${1-shell}
15+
16+
# Includes
17+
source $HESTIA/func/main.sh
18+
19+
# JSON list function
20+
json_list() {
21+
echo '['
22+
if [ -z "$check_cron" ]; then
23+
echo -e "\t\"Disabled\","
24+
else
25+
echo -e "\t\"Enabled\""
26+
fi
27+
echo "]"
28+
}
29+
30+
# SHELL list function
31+
shell_list() {
32+
echo -n "AUTOUPDATE: "
33+
if [ -z "$check_cron" ]; then
34+
echo "Disabled"
35+
else
36+
echo "Enabled"
37+
fi
38+
}
39+
40+
# PLAIN list function
41+
plain_list() {
42+
if [ -z "$check_cron" ]; then
43+
echo "Disabled"
44+
else
45+
echo "Enabled"
46+
fi
47+
}
48+
49+
# CSV list function
50+
csv_list() {
51+
echo "AUTOUPDATE"
52+
if [ -z "$check_cron" ]; then
53+
echo "Disabled"
54+
else
55+
echo "Enabled"
56+
fi
57+
}
58+
59+
60+
#----------------------------------------------------------#
61+
# Action #
62+
#----------------------------------------------------------#
63+
64+
# Check cron tab
65+
check_cron=$(grep 'v-update-sys-hestia-all' $USER_DATA/cron.conf)
66+
67+
# Listing data
68+
case $format in
69+
json) json_list ;;
70+
plain) plain_list ;;
71+
csv) csv_list ;;
72+
shell) shell_list;;
73+
esac
74+
75+
76+
77+
#----------------------------------------------------------#
78+
# Hestia #
79+
#----------------------------------------------------------#
80+
81+
exit

0 commit comments

Comments
 (0)