vesta/bin/v-list-sys-vesta-autoupdate
Serghey Rodin ff7d48bf66 Merge pull request #691 from runelaenen/patch-1
Fix wrong documentation
2016-06-25 11:17:21 +03:00

82 lines
1.6 KiB
Bash
Executable File

#!/bin/bash
# info: list vesta autoupdate settings
# options: [FORMAT]
#
# The function for obtaining autoupdate setings.
#----------------------------------------------------------#
# Variable&Function #
#----------------------------------------------------------#
# Argument definition
user='admin'
format=${1-shell}
# Includes
source $VESTA/func/main.sh
# 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-vesta-all' $USER_DATA/cron.conf)
# Listing data
case $format in
json) json_list ;;
plain) plain_list ;;
csv) csv_list ;;
shell) shell_list;;
esac
#----------------------------------------------------------#
# Vesta #
#----------------------------------------------------------#
exit