v-list-sys-vesta-autoupdate 1.6 KB

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