I have existing awstats folders in my Users public_html folders. I need to make them links
If you have the old awstats plugin, it will have created folders in your Users public_html directories.
If you want to view the DA version of the awstats from the same domain.com/awstats path, you'll have to remove all folders and replace them with links.
To do that, you can use this basic script to remove any foldres and replace them with links.
Create a file called fix.sh and put in it the following code
for i in `ls -d /home/*/domains/*/public_html/awstats`; do
if [ -h $i ]; then
echo "$i is a link, skipping";
rm -rf $i
ln -s ../awstats $i
save and chmod the script to 755. Run it.
chmod 755 fix.sh
Note that the above code only swaps the public_html/awstats directory
with a link. If no previous directory exists, it won't do anything.
If you're looking to add links to account where nothing exists in the first place, use this code instead:
for i in `ls -d /home/*/domains/*/public_html`; do
if [ -e $ASL ]; then
echo "$ASL exists, skipping";
ln -s ../awstats $ASL
which will add a link if no public_html/awstats path exists.