You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
hestiacp/bin/v-list-sys-hestia-autoupdate

85 lines
1.7 KiB

#!/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