GoAccess 宝塔面板 定时生成可视化页面脚本

in 笔记 with 0 comment

bdc4ed22031f49c0be8a707b66284d1.png

wget -O - https://deb.goaccess.io/gnugpg.key | gpg --dearmor | sudo tee /usr/share/keyrings/goaccess.gpg >/dev/null
echo "deb [signed-by=/usr/share/keyrings/goaccess.gpg] https://deb.goaccess.io/ $(lsb_release -cs) main" | sudo tee /etc/apt/sources.list.d/goaccess.list
sudo apt-get update
sudo apt-get install goaccess
#!/bin/sh
LANG="zh_CN.UTF-8"
for file in /www/wwwlogs/*
do
    if [ -f $file ]
    then
        filename=${file##*/}
        #存放生成文件的位置
        file_html=/www/wwwroot/goaccess.site/index/${filename%%.log}.html
        if [[ $filename =~ log && $filename != *erro* && $filename != access.log ]]
        then
        echo $filename
          LANG="zh_CN.UTF-8" bash -c " goaccess -f $file -a > $file_html --log-format=COMBINED"
        fi
    fi
done
Responses