I have existing awstats folders in my Users public_html folders. I need to make them links


Enter Your Query:
Use '%' for wildcards and quotes for "exact phrases"


Top Level » System Level

I have existing awstats folders in my Users public_html folders. I need to make them linksLast Modified: Mar 1, 2013, 2:21 pm
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

#!/bin/sh

for i in `ls -d /home/*/domains/*/public_html/awstats`; do
{
   if [ -h $i ]; then
     echo "$i is a link, skipping";
     continue;
   fi

   rm -rf $i
   ln -s ../awstats $i
};
done;

save and chmod the script to 755.  Run it.

chmod 755 fix.sh
./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:

#!/bin/sh

for i in `ls -d /home/*/domains/*/public_html`; do
{
   ASL=$i/awstats
   if [ -e $ASL ]; then
     echo "$ASL exists, skipping";
     continue;
   fi

   ln -s ../awstats $ASL
};
done;

which will add a link if no public_html/awstats path exists.

2003 JBMC Software, Suite 173  3-11 Bellerose Drive, St Albert, AB  T8N 1P7  Canada.  Mon-Fri 9AM-5PM MST