I wrote a small script (based on help.directadmin.com) to move existing awstats plugin data to Direct Admin's own Awstats data. Mostly usefull for new installs, since it will overwrite the current data.
What this script does:
- remove awstats folder in public_html folders and create symbolic link to DA awstats (public_html/../awstats)
- move awstats plugin data (/home/user/domains/domain/stats/awstats*.txt) to correct folder for DA's own awstatsv(/home/user/domains/domain/awstats/.data
While I checked all of this, I might have made some mistakes. So no guarantees here. Use this at your own risk!
What this script does:
- remove awstats folder in public_html folders and create symbolic link to DA awstats (public_html/../awstats)
- move awstats plugin data (/home/user/domains/domain/stats/awstats*.txt) to correct folder for DA's own awstatsv(/home/user/domains/domain/awstats/.data
While I checked all of this, I might have made some mistakes. So no guarantees here. Use this at your own risk!
Code:
#!/bin/sh
# Remove old awstats folder and create link to DA awstats
for i in `ls -d /home/*/domains/*/public_html/awstats`; do
{
if [ -h $i ]; then
echo "$i is a link, skipping";
continue;
fi
echo "Removing old awstats folder $i and creating link to DA awstats";
rm -rf $i
ln -s ../awstats $i
};
done;
# Move old awstats data to DA awstats data
for i in `ls -d /home/*/domains/*/stats`; do
{
if [ ! -d $i/../awstats ]; then
echo "Creating folder $i/../awstats";
mkdir $i/../awstats
fi
if [ ! -d $i/../awstats/.data ]; then
echo "Creating folder $i/../awstats/.data";
mkdir $i/../awstats/.data
fi
if [ -d $i/../awstats/.data ]; then
mv $i/awstats*.txt $i/../awstats/.data/
# not sure if this is really necessary
mv $i/dnscachelastupdate.*.txt $i/../awstats/.data
else
echo "Folder $i/../awstats/.data does not exist";
fi
};
done;