|
@@ -17,8 +17,15 @@
|
|
|
|
|
|
|
|
|
output_html(){
|
|
|
- INDEX_HTML=/var/www/html/index.html
|
|
|
- mkdir -p /var/www/html/
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ if [ ! -e '/etc/redhat-release' ]; then
|
|
|
+ INDEX_HTML=/var/www/html/index.html
|
|
|
+ mkdir -p /var/www/html/
|
|
|
+ else
|
|
|
+ INDEX_HTML=/usr/share/nginx/html/index.html
|
|
|
+ fi
|
|
|
|
|
|
echo '<!DOCTYPE html><meta charset=utf-8><pre>' > ${INDEX_HTML}
|
|
|
|
|
@@ -36,14 +43,13 @@ output_html(){
|
|
|
|
|
|
vnstat_install(){
|
|
|
|
|
|
-
|
|
|
+
|
|
|
if [ ! -e '/etc/redhat-release' ]; then
|
|
|
- alias apt='apt'
|
|
|
+ apt -y install vnstat nginx
|
|
|
else
|
|
|
- alias apt='yum'
|
|
|
+ yum -y install vnstat nginx wget
|
|
|
fi
|
|
|
|
|
|
- apt -y install vnstat nginx
|
|
|
|
|
|
|
|
|
ni=$(ls /sys/class/net | awk {print} | grep -e eth. -e ens. -e venet.)
|
|
@@ -58,7 +64,7 @@ vnstat_install(){
|
|
|
echo "*/10 * * * * wget -qO- git.io/fxxlb | bash" >> crontab.txt
|
|
|
crontab crontab.txt
|
|
|
sleep 2
|
|
|
- if [! -e '/etc/redhat-release' ];then
|
|
|
+ if [ ! -e '/etc/redhat-release' ]; then
|
|
|
systemctl restart cron
|
|
|
else
|
|
|
systemctl restart crond
|
|
@@ -68,11 +74,10 @@ vnstat_install(){
|
|
|
}
|
|
|
|
|
|
|
|
|
-if [ ! -f '/etc/vnstat.conf' ]; then
|
|
|
+if [ ! -f '/usr/bin/vnstat' ]; then
|
|
|
vnstat_install
|
|
|
fi
|
|
|
|
|
|
|
|
|
output_html
|
|
|
|
|
|
-
|