Skip to content

Commit 396f005

Browse files
authored
Upgrade Netdata script
1 parent bd26d5d commit 396f005

File tree

1 file changed

+14
-20
lines changed

1 file changed

+14
-20
lines changed

apps/netdata.sh

Lines changed: 14 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
# T&M Hansson IT AB © - 2024, https://www.hanssonit.se/
44

5-
# shellcheck disable=2034,2059
65
true
76
SCRIPT_NAME="Netdata"
87
SCRIPT_EXPLAINER="Netdata is an open source tool designed to collect real-time metrics, \
@@ -20,19 +19,9 @@ source /var/scripts/fetch_lib.sh || source <(curl -sL https://raw.githubusercont
2019
DEBUG=0
2120
debug_mode
2221

23-
# Must be root
22+
# Must be sudo
2423
root_check
2524

26-
# Can't be run as pure root user
27-
if [ -z "$UNIXUSER" ]
28-
then
29-
msg_box "You can't run this script as a pure root user. You need to issue the following command:
30-
sudo -u regular_user sudo bash $SCRIPTS/menu.sh
31-
32-
Then choose Additional Apps --> Netdata"
33-
exit 1
34-
fi
35-
3625
# Check if netdata is already installed
3726
if ! [ -d /etc/netdata ]
3827
then
@@ -42,35 +31,40 @@ else
4231
# Ask for removal or reinstallation
4332
reinstall_remove_menu "$SCRIPT_NAME"
4433
# Removal
34+
touch /etc/netdata/.environment
4535
if [ -f /usr/src/netdata.git/netdata-uninstaller.sh ]
4636
then
47-
if ! yes no | bash /usr/src/netdata.git/netdata-uninstaller.sh --force
37+
if ! yes no | bash /usr/src/netdata.git/netdata-uninstaller.sh -y -f
4838
then
4939
rm -Rf /usr/src/netdata.git
5040
fi
5141
elif [ -f /usr/libexec/netdata-uninstaller.sh ]
5242
then
53-
yes no | bash /usr/libexec/netdata-uninstaller.sh --yes
43+
yes no | bash /usr/libexec/netdata-uninstaller.sh -y -f
5444
elif [ -f /usr/libexec/netdata/netdata-uninstaller.sh ]
5545
then
56-
bash /usr/libexec/netdata/netdata-uninstaller.sh --force --yes
46+
bash /usr/libexec/netdata/netdata-uninstaller.sh -y -f
5747
else
58-
check_command curl_to_dir https://raw.githubusercontent.com/netdata/netdata/master/packaging/installer netdata-uninstaller.sh $SCRIPTS
59-
check_command bash $SCRIPTS/netdata-uninstaller.sh --force --yes
48+
curl_to_dir https://raw.githubusercontent.com/netdata/netdata/master/packaging/installer netdata-uninstaller.sh $SCRIPTS
49+
check_command bash $SCRIPTS/netdata-uninstaller.sh -y -f
6050
rm $SCRIPTS/netdata-uninstaller.sh
6151
rm -rf /var/lib/netdata
6252
fi
6353
rm -rf /etc/netdata
54+
apt-get purge netdata -y
55+
apt-get autoremove -y
56+
rm -rf /var/cache/netdata
57+
rm -rf /var/log/netdata
6458
# Show successful uninstall if applicable
6559
removal_popup "$SCRIPT_NAME"
6660
fi
6761

6862
# Install
6963
is_process_running dpkg
7064
is_process_running apt
71-
apt update -q4 & spinner_loading
72-
curl_to_dir https://my-netdata.io kickstart.sh $SCRIPTS
73-
sudo -u "$UNIXUSER" bash $SCRIPTS/kickstart.sh all --dont-wait --no-updates --stable-channel
65+
apt-get update -q4 & spinner_loading
66+
curl_to_dir https://get.netdata.cloud kickstart.sh $SCRIPTS
67+
bash $SCRIPTS/kickstart.sh --reinstall-even-if-unsafe --non-interactive --no-updates --stable-channel --disable-cloud
7468
rm -f $SCRIPTS/kickstart.sh
7569

7670
# Check Netdata instructions after script is done

0 commit comments

Comments
 (0)