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
|
rm -r /srv/www/$domain
|
||||||
fi
|
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
|
done
|
||||||
fi
|
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.
|
# output instructions for sycning website to new server, if verbose option was enabled.
|
||||||
if [[ -n $verbose ]]; then
|
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='.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/"
|
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
|
if [[ -f /srv/www/$domain/.exp/mysql/$database.sql ]]; then
|
||||||
echo "mysql $database < /srv/www/$domain/.exp/mysql/$database.sql"
|
echo "mysql $database < /srv/www/$domain/.exp/mysql/$database.sql"
|
||||||
fi
|
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
|
# /etc/ configs
|
||||||
if [[ -d /srv/www/$domain/.exp/etc ]]; then
|
if [[ -d /srv/www/$domain/.exp/etc ]]; then
|
||||||
echo "cp -a /srv/www/$domain/.exp/etc/* /etc/"
|
echo "cp -a /srv/www/$domain/.exp/etc/* /etc/"
|
||||||
|
|
|
@ -97,7 +97,7 @@
|
||||||
</FilesMatch>
|
</FilesMatch>
|
||||||
SSLEngine on
|
SSLEngine on
|
||||||
SSLCertificateFile /etc/ssl/letsencrypt/$vhost.pem
|
SSLCertificateFile /etc/ssl/letsencrypt/$vhost.pem
|
||||||
Alias /stats /srv/www/$vhost/stats
|
Alias /stats /var/lib/webalizer/$vhost
|
||||||
AddExternalAuth pwauth /usr/sbin/pwauth
|
AddExternalAuth pwauth /usr/sbin/pwauth
|
||||||
SetExternalAuthMethod pwauth pipe
|
SetExternalAuthMethod pwauth pipe
|
||||||
<Location /stats>
|
<Location /stats>
|
||||||
|
|
|
@ -166,6 +166,7 @@ cp etc/logrotate.d/apache2 /etc/logrotate.d/apache2
|
||||||
chmod 644 /etc/logrotate.d/apache2
|
chmod 644 /etc/logrotate.d/apache2
|
||||||
rm /etc/cron.daily/webalizer
|
rm /etc/cron.daily/webalizer
|
||||||
rmdir /srv/www/webalizer
|
rmdir /srv/www/webalizer
|
||||||
|
install --owner=root --group=root --mode=755 --directory /var/lib/webalizer
|
||||||
systemctl enable --now webalizer.timer
|
systemctl enable --now webalizer.timer
|
||||||
|
|
||||||
# install status.php
|
# install status.php
|
||||||
|
|
|
@ -19,12 +19,15 @@ if [ ${#virtualhosts[@]} -gt 0 ]; then
|
||||||
do
|
do
|
||||||
if [[ -f /var/spool/apache2/$virtualhost.log ]]; then
|
if [[ -f /var/spool/apache2/$virtualhost.log ]]; then
|
||||||
user=$(stat -c '%U' /srv/www/$virtualhost)
|
user=$(stat -c '%U' /srv/www/$virtualhost)
|
||||||
if [[ ! -d /srv/www/$virtualhost/stats ]]; then
|
if [[ ! -d /var/lib/webalizer/$virtualhost ]]; then
|
||||||
install --owner=$user --group=$user --mode=755 --directory /srv/www/$virtualhost/stats
|
if [[ ! -d /var/lib/webalizer ]]; then
|
||||||
|
install --owner=root --group=root --mode=755 --directory /var/lib/webalizer
|
||||||
fi
|
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
|
/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
|
/usr/bin/rm /var/spool/apache2/$virtualhost.log
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
Loading…
Reference in New Issue
Block a user