Loading

updater-netdata.sh

  1. #!/bin/bash
  2. #
  3. # Script Updater for netdata
  4. #
  5. #   - Depencies: Wring package (NPM)
  6. #
  7. #  By Erreur32 - 2018
  8. #
  9. #bash <(curl -Ss https://my-netdata.io/kickstart.sh)
  10.  
  11. apt-get install  build-essential g++ g++-6 libc6-dev libncurses5-dev libpcap-dev libpcap0.8-dev libstdc++-6-dev linux-libc-dev uuid zlib1g-dev -y
  12. bash -x <(curl -Ss https://raw.githubusercontent.com/netdata/netdata-demo-site/master/install-required-packages.sh) --non-interactive --dont-wait netdata
  13.  
  14. service=netdata
  15. releasehub=https://github.com/netdata/netdata/tags
  16. #git clone https://github.com/firehol/netdata.git --depth=1 && cd netdata && echo -ne '\n' | ./netdata-installer.sh --install /opt
  17. # /opt/netdata/netdata-installer.sh --install /opt
  18.  
  19. _RESET="$(tput sgr 0)"
  20.                         BLACK="$(tput setaf 0)"
  21.                         RED="$(tput setaf 1)"
  22.                         GREEN="$(tput setaf 2)"
  23.                         YELLOW="$(tput setaf 3)"
  24.                         BLUE="$(tput setaf 4)"
  25.                         PURPLE="$(tput setaf 5)"
  26.                         CYAN="$(tput setaf 6)"
  27.                         WHITE="$(tput setaf 7)"
  28.                         BGBLACK="$(tput setab 0)"
  29.                         BGRED="$(tput setab 1)"
  30.                         BGGREEN="$(tput setab 2)"
  31.                         BGYELLOW="$(tput setab 3)"
  32.                         BGBLUE="$(tput setab 4)"
  33.                         BGPURPLE="$(tput setab 5)"
  34.                         BGCYAN="$(tput setab 6)"
  35.                         BGWHITE="$(tput setab 7)"
  36.                         BOLD="$(tput bold)"
  37.                         DIM="$(tput dim)"
  38.                         UNDERLINED="$(tput smul)"
  39.                         BLINK="$(tput blink)"
  40.                         INVERTED="$(tput rev)"
  41.                         STANDOUT="$(tput smso)"
  42.                         BELL="$(tput bel)"
  43.                         CLEAR="$(tput clear)"
  44.  
  45.  
  46. NOC=$(tput sgr0)
  47. NC=$(tput sgr0)
  48.  
  49.  
  50. ## Check if wring is installed
  51. if [ -f "/usr/bin/wring" ] ||  [ -f "/usr/local/bin/wring" ]
  52.      then
  53.       echo -e "\n\e[34m - Wring package \e[0m>> founded.\e[0m\n"
  54.      else
  55.       echo -e "\n\e[92m - Install Wring with NPM \e[0m\n"
  56.       npm install --global wring  && echo "Success install  Wring" || echo "failure to install Wring"
  57.       echo -e "\n\e[34m - .\e[0m\n"
  58.      fi
  59.  
  60. # need to check in other way...   /usr/sbin/netdata -V | cut -c"9-" |  cut -c "1-6"
  61. #/home/opt/netdata/usr/sbin/netdata
  62. VersionInstalled="$(/usr/sbin/netdata -v | cut -c"9-" |  cut -c "1-7")"
  63. #VersionAvailable="$(curl -s $releasehub |  wring text - '.muted-link' |sed -n 8p)"
  64. VersionAvailable="$(curl -s https://github.com/netdata/netdata/tags |  wring text - '.commit-title' | head -n1)"
  65. echo -e "$RED Checking $service version ... "
  66. echo -e "$YELLOW Version installed = $VersionInstalled"
  67. echo -e "$YELLOW Version Available = $VersionAvailable"
  68. echo  ""
  69.  
  70. # go to the git downloaded directory
  71. #cd /opt/netdata
  72.  
  73.  
  74. if [ -z "$VersionInstalled" ]
  75. then
  76.    echo -e "$service is not installed - exit "
  77.    exit
  78. fi
  79. if [[ "$VersionAvailable" = "$VersionInstalled" ]]
  80. then
  81.     echo -e "$service  is already up-to-date (version $VersionInstalled) ... Bye! "
  82.     exit
  83. fi
  84.  
  85. #echo -e "${GREEN} Start install New Updater from Netdata $NC"
  86. #echo -e " $NC"
  87. echo -e "$GREEN Start Updating Netdata...${YELLOW}"
  88. #/bin/bash /opt/netdata-installer.sh  && echo -e "  Updating Netdata Successfully!" || echo "failure"
  89.  
  90. #Git_Pull(){
  91. cd /opt/netdata && /usr/bin/git pull
  92. #}
  93. #/usr/bin/git pull
  94.  
  95. #/opt/netdata/netdata-installer.sh
  96. yes "" | /opt/netdata/netdata-installer.sh --libs-are-really-here --install /opt  --libs-are-really-here
  97.  
  98. #-pidfile /opt/netdata/netdata.pid
  99.  
  100. echo -e " ${ORANGE}"; ps -A|grep netdata
  101. echo ""
  102. echo -e "${GREEN} Netdata Updated ✔ "
  103. echo -e " $NC"
  104.  
  105.  
  106.  
  107. # download the latest version
  108. #git pull
  109. #git log | grep ^commit | head -n 1 | cut -d ' ' -f 2
  110. #yes "" | ./netdata-installer.sh --install /opt
  111.  
  112. # && echo -ne '/n'
  113.  
  114. # rebuild it, install it, run it
  115. #./netdata-installer.sh

Version history

Revision # Author Created at
pbqveux9t Erreur32 11 Nov 2018, 12:04:54 UTC Diff

Comments