put webalizer stats in /var/lib/webalizer/
This commit is contained in:
parent
812fa2dd01
commit
51211415b2
|
@ -83,3 +83,8 @@ if [[ -d /srv/www/$domain ]]; then
|
|||
rm -r /srv/www/$domain
|
||||
fi
|
||||
|
||||
# remove webalizer stats
|
||||
if [[ -d /var/lib/webalizer/$domain ]]; then
|
||||
rm -r /var/lib/webalizer/$domain
|
||||
fi
|
||||
|
||||
|
|
|
@ -81,6 +81,11 @@ if [[ -d /srv/www/$domain ]]; then
|
|||
done
|
||||
fi
|
||||
|
||||
# webalizer stats
|
||||
if [[ -d /var/lib/webalizer/$domain ]]; then
|
||||
cp --archive /var/lib/webalizer/$domain /srv/www/$domain/.exp/webalizer
|
||||
fi
|
||||
|
||||
# output instructions for sycning website to new server, if verbose option was enabled.
|
||||
if [[ -n $verbose ]]; then
|
||||
|
||||
|
@ -125,11 +130,16 @@ if [[ -d /srv/www/$domain ]]; then
|
|||
echo "rsync -v --archive --exclude='.passwd' --rsh=/usr/bin/ssh root@$servername:/home/$username/ /home/$username/"
|
||||
echo "rsync -v --archive --exclude='.my.cnf' --rsh=/usr/bin/ssh root@$servername:/srv/www/$domain/ /srv/www/$domain/"
|
||||
|
||||
#db import
|
||||
# db import
|
||||
if [[ -f /srv/www/$domain/.exp/mysql/$database.sql ]]; then
|
||||
echo "mysql $database < /srv/www/$domain/.exp/mysql/$database.sql"
|
||||
fi
|
||||
|
||||
# webalizer stats
|
||||
if [[ -d /var/lib/webalizer/$domain ]]; then
|
||||
echo "cp --archive /srv/www/$domain/.exp/webalizer /var/lib/webalizer/$domain"
|
||||
fi
|
||||
|
||||
# /etc/ configs
|
||||
if [[ -d /srv/www/$domain/.exp/etc ]]; then
|
||||
echo "cp -a /srv/www/$domain/.exp/etc/* /etc/"
|
||||
|
|
|
@ -97,7 +97,7 @@
|
|||
</FilesMatch>
|
||||
SSLEngine on
|
||||
SSLCertificateFile /etc/ssl/letsencrypt/$vhost.pem
|
||||
Alias /stats /srv/www/$vhost/stats
|
||||
Alias /stats /var/lib/webalizer/$vhost
|
||||
AddExternalAuth pwauth /usr/sbin/pwauth
|
||||
SetExternalAuthMethod pwauth pipe
|
||||
<Location /stats>
|
||||
|
|
|
@ -166,6 +166,7 @@ cp etc/logrotate.d/apache2 /etc/logrotate.d/apache2
|
|||
chmod 644 /etc/logrotate.d/apache2
|
||||
rm /etc/cron.daily/webalizer
|
||||
rmdir /srv/www/webalizer
|
||||
install --owner=root --group=root --mode=755 --directory /var/lib/webalizer
|
||||
systemctl enable --now webalizer.timer
|
||||
|
||||
# install status.php
|
||||
|
|
|
@ -19,12 +19,15 @@ if [ ${#virtualhosts[@]} -gt 0 ]; then
|
|||
do
|
||||
if [[ -f /var/spool/apache2/$virtualhost.log ]]; then
|
||||
user=$(stat -c '%U' /srv/www/$virtualhost)
|
||||
if [[ ! -d /srv/www/$virtualhost/stats ]]; then
|
||||
install --owner=$user --group=$user --mode=755 --directory /srv/www/$virtualhost/stats
|
||||
if [[ ! -d /var/lib/webalizer/$virtualhost ]]; then
|
||||
if [[ ! -d /var/lib/webalizer ]]; then
|
||||
install --owner=root --group=root --mode=755 --directory /var/lib/webalizer
|
||||
fi
|
||||
/usr/bin/webazolver -Q -N 20 -D /var/lib/webalizer_dns_cache.db -o /srv/www/$virtualhost/stats /var/spool/apache2/$virtualhost.log
|
||||
install --owner=$user --group=$user --mode=755 --directory /var/lib/webalizer/$virtualhost
|
||||
fi
|
||||
/usr/bin/webazolver -Q -N 20 -D /var/lib/webalizer_dns_cache.db -o /var/lib/webalizer/$virtualhost /var/spool/apache2/$virtualhost.log
|
||||
/usr/bin/logger Running Webalizer for $virtualhost as user $user
|
||||
su --shell=/bin/bash -c "/usr/bin/webalizer -Q -D /var/lib/webalizer_dns_cache.db -N 0 -p -f -n $virtualhost -o /srv/www/$virtualhost/stats /var/spool/apache2/$virtualhost.log" $user
|
||||
su --shell=/bin/bash -c "/usr/bin/webalizer -Q -D /var/lib/webalizer_dns_cache.db -N 0 -p -f -n $virtualhost -o /var/lib/webalizer/$virtualhost /var/spool/apache2/$virtualhost.log" $user
|
||||
/usr/bin/rm /var/spool/apache2/$virtualhost.log
|
||||
fi
|
||||
done
|
||||
|
|
Loading…
Reference in New Issue
Block a user