Initial
This commit is contained in:
84
bin/v-list-sys-hestia-autoupdate
Executable file
84
bin/v-list-sys-hestia-autoupdate
Executable file
@@ -0,0 +1,84 @@
|
||||
#!/bin/bash
|
||||
# info: list hestia autoupdate settings
|
||||
# options: [FORMAT]
|
||||
#
|
||||
# example: v-list-sys-hestia-autoupdate
|
||||
#
|
||||
# This function for obtaining autoupdate settings.
|
||||
|
||||
#----------------------------------------------------------#
|
||||
# Variables & Functions #
|
||||
#----------------------------------------------------------#
|
||||
|
||||
# Argument definition
|
||||
user='admin'
|
||||
format=${1-shell}
|
||||
|
||||
# Includes
|
||||
# shellcheck source=/etc/hestiacp/hestia.conf
|
||||
source /etc/hestiacp/hestia.conf
|
||||
# shellcheck source=/usr/local/hestia/func/main.sh
|
||||
source $HESTIA/func/main.sh
|
||||
# load config file
|
||||
source_conf "$HESTIA/conf/hestia.conf"
|
||||
|
||||
# JSON list function
|
||||
json_list() {
|
||||
echo '['
|
||||
if [ -z "$check_cron" ]; then
|
||||
echo -e "\t\"Disabled\","
|
||||
else
|
||||
echo -e "\t\"Enabled\""
|
||||
fi
|
||||
echo "]"
|
||||
}
|
||||
|
||||
# SHELL list function
|
||||
shell_list() {
|
||||
echo -n "AUTOUPDATE: "
|
||||
if [ -z "$check_cron" ]; then
|
||||
echo "Disabled"
|
||||
else
|
||||
echo "Enabled"
|
||||
fi
|
||||
}
|
||||
|
||||
# PLAIN list function
|
||||
plain_list() {
|
||||
if [ -z "$check_cron" ]; then
|
||||
echo "Disabled"
|
||||
else
|
||||
echo "Enabled"
|
||||
fi
|
||||
}
|
||||
|
||||
# CSV list function
|
||||
csv_list() {
|
||||
echo "AUTOUPDATE"
|
||||
if [ -z "$check_cron" ]; then
|
||||
echo "Disabled"
|
||||
else
|
||||
echo "Enabled"
|
||||
fi
|
||||
}
|
||||
|
||||
#----------------------------------------------------------#
|
||||
# Action #
|
||||
#----------------------------------------------------------#
|
||||
|
||||
# Check cron tab
|
||||
check_cron=$(grep 'v-update-sys-hestia-all' $USER_DATA/cron.conf)
|
||||
|
||||
# Listing data
|
||||
case $format in
|
||||
json) json_list ;;
|
||||
plain) plain_list ;;
|
||||
csv) csv_list ;;
|
||||
shell) shell_list ;;
|
||||
esac
|
||||
|
||||
#----------------------------------------------------------#
|
||||
# Hestia #
|
||||
#----------------------------------------------------------#
|
||||
|
||||
exit
|
||||
Reference in New Issue
Block a user