Mini Shell

Direktori : /proc/self/root/opt/imh-atop/
Upload File :
Current File : //proc/self/root/opt/imh-atop/netatop_inst.sh

#!/bin/bash
exit 0 # netatop Disabled
# Installs netatop kernel module
# This would be a package but it needs to install the kernel-devel-$(uname -r) packages

VERSION=$(cat /opt/imh-atop/netatop_version)

#Make sure the versions of devel and headers for the current kernel are installed too
if grep -q cloudlinux /etc/os-release
then
    yum -y install kernel-devel-$(uname -r) dkms gcc make kernel-headers
fi

if grep -qi virtuozzo /etc/os-release
then
    yum -y install vzkernel-devel-$(uname -r) vzkernel-devel dkms gcc make kernel-headers
fi

if grep -q ubuntu /etc/os-release
then
    apt-get -y install linux-headers-$(uname -r) dkms gcc make
fi

rm -rf /var/lib/dkms/netatop/${VERSION}
mkdir -p /opt/imh-atop
cd /opt/imh-atop
wget https://www.atoptool.nl/download/netatop-${VERSION}.tar.gz
cd /usr/src/
tar xf /opt/imh-atop/netatop-${VERSION}.tar.gz
cd netatop-${VERSION}
make
make install
dkms install netatop/${VERSION}

mkdir -p /etc/systemd/system/netatop.service.d/
cat > /etc/systemd/system/netatop.service.d/override.conf << EOF
[Unit]
ConditionPathExists=/opt/imh-atop/enabled
EOF

cat > /etc/systemd/system/atop.service.d/override.conf << EOF
[Unit]
ConditionPathExists=/opt/imh-atop/enabled
Wants=netatop.service
EOF

systemctl daemon-reload
systemctl enable netatop
systemctl start netatop
systemctl enable atop.service
systemctl stop atop.service
systemctl start atop.service

Zerion Mini Shell 1.0