View Full Version : AWStats 6.1 - easy install/remove script here.
Hi,
I had a look around for an quick and easy way to install AWStats on some domains , not as a serverwide solution .
I didn't find the 'magic' install script that I wanted (one that requires no thinking:) .. so I took a bit of time to write one. I thought it ended up being usefull enough to be posted here as it might help other people. Unless AWStats is part of DA or Installatron already and I havent noticed :)
In summary, it's a perl script that must be run as root, it takes the username , domain and action (add/remove) as arguments.
No questions asked, it downloads AWStats 6.4 the first time you use it , unpacks it, installs it for a specific domain, creates the conf file and user cron job , processes logs for the first time and that's it, you can just go to the url and browse the stats.
Dont want it anymore on a domain ?, run the script again with a -d argument and all is gone, including the cron job.
I'm not sure if DA allows execution of scripts after adding a domain, nor which arguments are passed on, but it's probably an easy process to use it to automatically add AWStats when a domain is added.
It can be downloaded from :
http://directadmin.domaindirect.com.au
The script, description and a bit of help is available on the above page. Comments & bug reports are welcome here.
( There is an issue with this script < 2.2 and DA >= 1.24 please read the message with subject "WARNING" in this thread for more info about this issue and work around)
Miky
Peter Verrill
06-22-2004, 08:47 AM
Hey,
Nice tool :cool:
Small bug:
For log processing summary, check /home/USER/domains/DOMAIN/publich_html/cgi-bin/awstats/status.log
Should be public_html ;)
Thanks , fixed it was in a feedback statement so it was only cosmectic.
Miky
WebrulerHosting
06-23-2004, 04:52 AM
It sure works fine :)
vandal
06-30-2004, 11:44 AM
this appears to be working great!
good job.
ircman
08-19-2004, 07:35 AM
Hi Miky,
Is it possible for you to make a server wide solution of this ?
Cos I want the stats per user and not like other aw-stats scripts on a single domain.
Would like to help/test you with that :)
Cedric
Turbo M
09-10-2004, 11:30 AM
i ran the script but it didn't install the files in the right directory. What did I do wrong?
Originally posted by Turbo M
i ran the script but it didn't install the files in the right directory. What did I do wrong?
Not sure, unless your didnt run it as "root" , it can only copy needed files correctly if you run it as root. Any error message ?
Re Cedric's message ...
Yes, it is possible to modify it for serverwide use, even create a plugin but I saw that someone else was working on a awstats plugin, available in those forums, so I didn't go any futher with it.
Miky
Avenueduweb
09-20-2004, 08:57 AM
Thank you very much ! Very good job ! It's very easy to install ! And for install awstats for all new domain create this files :
/usr/local/directadmin/scripts/custom/domain_create_post.sh :
#!/bin/bash
cd /
./awsetup -a $username $domain
/usr/local/directadmin/scripts/custom/domain_destroy_pre.sh :
#!/bin/bash
cd /
./awsetup -d $username $domain
And with this files, when a user create a new domain, awstats is installed automatically for this domain. Bye.
Avenueduweb
09-21-2004, 02:43 AM
Oups... I've got a problem with cron jobs... I've got a webmin + directadmin on my server on i suppose this is a problem. When i add a cronjob in directadmin the cron jobs is added on :
- /usr/local/directadmin/data/users/user/crontab.conf
and
- /var/spool/cron/user
But when i run awsetup the cron job added only in this file :
- /usr/local/directadmin/data/users/user/crontab.conf
How do i do for the script run automatically ? Thanks. Bye.
Hi,
It wasnt adding the cronjob correctly untill the jobs were refreshed via the user's control panel.
I fine tuned that part a bit, it should add it properly now and restart crond automatically. I made it V1.1 , you would need to re-download it and remove/re-add the installs for it to fix the cronjobs properly. Lets see how it goes.
Miky
Avenueduweb
09-21-2004, 07:45 AM
Ok ! Thank you, i will install the new version. Bye.
travelbuff
09-26-2004, 07:46 PM
This is awesome, worked perfectly, just what I needed after spending 2hrs reading these forums trying to get webalizer to work....
Acid-Duck
10-03-2004, 09:20 AM
Originally posted by ircman
Hi Miky,
Is it possible for you to make a server wide solution of this ?
Cos I want the stats per user and not like other aw-stats scripts on a single domain.
Would like to help/test you with that :)
Cedric
Hi ircman,
Maybe I'm not understanding what you're asking for but here goes my idea. Look at this thread here (http://www.directadmin.com/forum/showthread.php?s=&threadid=3901) I think this is what you'd be looking for. It's an awstats pluggin that once installed, will be found in the "ADVANCED" section at the userlevel in DirectAdmin, and it lets users who would decide to install AwStats do so by themselves. They can even configure the stats from the control panel and password protect the directory.
Erik
Turbo M
10-09-2004, 02:20 PM
Originally posted by Miky
Not sure, unless your didnt run it as "root" , it can only copy needed files correctly if you run it as root. Any error message ?
Re Cedric's message ...
Yes, it is possible to modify it for serverwide use, even create a plugin but I saw that someone else was working on a awstats plugin, available in those forums, so I didn't go any futher with it.
Miky
yeah I ran it as root. The awstat directory was created but there were no files in there.
Here is the message that i got after I ran the awsetup script
Package downloaded and unpacked.
cp: illegal option -- a
usage: cp [-R [-H | -L | -P]] [-f | -i | -n] [-pv] src target
cp [-R [-H | -L | -P]] [-f | -i | -n] [-pv] src1 ... srcN directory
- CGIs installed.
cp: illegal option -- a
usage: cp [-R [-H | -L | -P]] [-f | -i | -n] [-pv] src target
cp [-R [-H | -L | -P]] [-f | -i | -n] [-pv] src1 ... srcN directory
cp: illegal option -- a
usage: cp [-R [-H | -L | -P]] [-f | -i | -n] [-pv] src target
cp [-R [-H | -L | -P]] [-f | -i | -n] [-pv] src1 ... srcN directory
cp: illegal option -- a
usage: cp [-R [-H | -L | -P]] [-f | -i | -n] [-pv] src target
cp [-R [-H | -L | -P]] [-f | -i | -n] [-pv] src1 ... srcN directory
cp: illegal option -- a
usage: cp [-R [-H | -L | -P]] [-f | -i | -n] [-pv] src target
cp [-R [-H | -L | -P]] [-f | -i | -n] [-pv] src1 ... srcN directory
- AWStats web directories installed.
- Config file created.
- Processing logs for the first time, this might take a few minutes...../home/dtmsite/domains/dtmpower.net/public_html/cgi-bin/awstats/awstats.pl: not found
Done.
chown: separation of user and group with a period is deprecated
chown: -R: No such file or directory
chown: separation of user and group with a period is deprecated
chown: -R: No such file or directory
- File permissions updated.
- Cron Job Added in DA User Cron Table.
- Cron Job Added in System User Cron Table.
All done, you can now access AWStats for this domain from :
-----------------------------------------------------------
http://www.dtmpower.net/cgi-bin/awstats/awstats.pl
Or
http://dtmpower.net/cgi-bin/awstats/awstats.pl?config=www.dtmpower.net
For log processing summary, check /home/dtmsite/domains/dtmpower.net/public_html/cgi-bin/awstats/status.log
The Cron Job can be edited from the user's control panel.
Sorry , completly missed the previous post.
Looks like it's a different 'cp' command which doesnt like -a
Check the man page for your cp command , there has to be an equivalent.
-a stands for Archive :
* never follow symbolic links
* preserve the specified attributes
* copy directories recursively
What is important is to copy recursively and preserve attributes(permissions)
Once you found the equivalent you can edit the script with pico or vi etc.. search for ' cp -a ' and replace with the correct argument(s). The cp command is used 4 or 5 times in the script.
And if you post them here, i'll update the script to deal with this cp command.
Cheers
Miky
different
12-14-2004, 12:35 AM
Hello..
It's work fine with awstats 6.1 in my system..
but the awstats 6.2 is released
when I change the awsetup to use awstats6.2.tgz
the 500 error will happened..
can you help me to update to awstats6.2
thanks...
Looks like quite a few people are using this script so I made a version 2.0 to install awstats 6.2
While i was at it, i added a -u option, so if a previous awsetup script was used to install awstats 6.1 , you can upgrade the install without loosing the created logs nor reset the cron job nor loosing directory protection if there was any. The -u option still re-creates the config file so if it was modified manually, it will be reset.
Re download awsetup (v2.0) and see how it goes, works fine here.
Miky
different
12-15-2004, 05:36 PM
Thanks for your kindly help..:)
Can you tell me the different between 6.1 and 6.2..
why I can't use v1.1 script to create.?
hope you can tell me the reason..
and I will try the new version of awsetup..
Thanks again..
A very tiny difference, the files awstats.pl and awdir.pl in the 6.1 archive have 755 permissions by default , the file awstats.pl in the 6.2 archive has 777 permissions and apache (suexec) wont execute a script with 777 permissions .
awsetup 1.1 just copies the files accross. awsetup 2.0 copies those files and sets them to 755. Plus I added the -u as it might be handy.
Miky
different
12-15-2004, 09:33 PM
Thanks...
So apache only allow the permission 755 for sucurity reason...
Next time if the perl script have 500 error..
I should check the permission first right?
I had update to version 2.0, it's seems ok..
If I install awstats this way...
will it be accessable to only the domain's admin? Or is there a way to make it accessible to someone without DA User Access?
(I'd like to install it for people to see that are not DirectAdmin users).
Thanks.
different
12-22-2004, 08:21 PM
Hi ..
I hope to have a new awsetup or awsetupall script, that can add the awstats to user, and add cron job for only admin's cron job or reseller's cron job, not user's, because if you have too many user, they will run awstats at the same time, but if you only add awstats to some sheel script, they will run step by step like these:
awstatsall.sh
/home/homerpub/domains/domain1.com/public_html/cgi-bin/awstats/awstats.pl -config=www.domain1.com/ -update > /home/homerpub/domains/domain1.com//public_html/cgi-bin/awstats/status.log
/home/homerpub/domains/domain2.com/public_html/cgi-bin/awstats/awstats.pl -config=www.domain2.com/ -update > /home/homerpub/domains/domain2.com//public_html/cgi-bin/awstats/status.log
and I needn't to waste time to change the cronjob time of every user.
I think it's not too hard to write a new script, but I hope to use your awsetup for my DA system. And I don't know your awsetup script is in GPL license or not, so I hope you can help me to develop the new version of awsetup that can run all the site no problem.
Thanks..
Thanks, it istalled with no problems :)
But there is a problem in how it's working.
I have an average of 56000 unique visitors a day, but awstats is displaying only about 5000, a very small fraction.
I have no idea what might be going on, the server log variable seems to point to the correct log location... any ideas why it's not showing me complete data?
Thanks.
> Re : any ideas why it's not showing me complete data?
56000 unique visitors a day seems to be an awfull lot, the only couple of things that i could think of would be .. either your really getting 5000 and whatever stats you were getting were incorrect .. or awstats cant deal with that much data in one go , or maybe the log files are croped to a max size and some data are lost by the time awstats runs.
Have you tried running it 2, 3 or 4 times a day instead of one ? you should anyway on a site getting that much traffic, it would help with the load on the system too.
Miky
In reply to : " different "
Yes , the code is GPL, there is not much to it really, anyone is welcome to make something better out of it.
I still think the next level should really be a pluggin, with something a bit more advanced for the cronjobs and reseller/user levels.
There is an other thread in those forums about an awstats pluggin, still betta, I tried it at an early stage and didnt like it because I had something slightly different in mind... but it was a while back and it would be stupid to re-invent the wheel .
If some people can try the betta awstats pluggin and let us know here if it is what they are after or not .
I sure would take a bit of time to write a serverwide awstats pluggin from scratch if it was any usefull... that was the original idea.
Miky
FastAttack
01-01-2005, 12:31 PM
i get this error:
- Package downloaded and unpacked.
cp: illegal option -- a
usage: cp [-R [-H | -L | -P]] [-f | -i | -n] [-pv] src target
cp [-R [-H | -L | -P]] [-f | -i | -n] [-pv] src1 ... srcN directory
- CGIs installed.
cp: illegal option -- a
usage: cp [-R [-H | -L | -P]] [-f | -i | -n] [-pv] src target
cp [-R [-H | -L | -P]] [-f | -i | -n] [-pv] src1 ... srcN directory
cp: illegal option -- a
usage: cp [-R [-H | -L | -P]] [-f | -i | -n] [-pv] src target
cp [-R [-H | -L | -P]] [-f | -i | -n] [-pv] src1 ... srcN directory
cp: illegal option -- a
usage: cp [-R [-H | -L | -P]] [-f | -i | -n] [-pv] src target
cp [-R [-H | -L | -P]] [-f | -i | -n] [-pv] src1 ... srcN directory
cp: illegal option -- a
usage: cp [-R [-H | -L | -P]] [-f | -i | -n] [-pv] src target
cp [-R [-H | -L | -P]] [-f | -i | -n] [-pv] src1 ... srcN directory
- AWStats web directories installed.
- Config file created.
- Processing logs for the first time, this might take a few minutes...../home/admin/domains/elm2.com/public_html/cgi-bin/awstats/awstats.pl: not found
Done.
chown: admin.admin: Invalid argument
chown: admin.admin: Invalid argument
chmod: /home/admin/domains/elm2.com/public_html/cgi-bin/awstats/awstats.pl: No such file or directory
chmod: /home/admin/domains/elm2.com/public_html/cgi-bin/awstats/awredir.pl: No such file or directory
- File permissions updated.
- Cron Job Added in DA User Cron Table.
- Cron Job Added in System User Cron Table.
most likely cause its a freebsd system?
Yes the cp command seems different .. i manage to get hold of a freebsd cp man page you can try :
edit the script with pico or other text editor:
# pico -w awsetup.pl
Search for cp -a in the 'install section' i think there are 5 of those, try to change it to
cp -R -p
Search for cp -a -f in the 'upgrade section' i think there are 5 of those, try to change it to
cp -R -p -f
Let us know if that does the trick , if so i'll change the script to handle freebsd as well.
Cheers
Miky
FastAttack
01-19-2005, 08:51 PM
- Package downloaded and unpacked.
- CGIs installed.
- AWStats web directories installed.
- Config file created.
- Processing logs for the first time, this might take a few minutes.....Done.
chown: admin.admin: Invalid argument
chown: admin.admin: Invalid argument
- File permissions updated.
- Cron Job Added in DA User Cron Table.
- Cron Job Added in System User Cron Table.
is what I get
see the chown arguement I guess that doesn't work for Freebsd.
Then it works up to a point until you go to the .pl file
Internal Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request.
Please contact the server administrator, webmaster and inform them of the time the error occurred, and anything you might have done that may have caused the error.
More information about this error may be available in the server error log.
Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.
Nice program, made my life that much easier.
I just have a slight problem, all the images in the statistics page show up as broken links. It seems that this script has made all the images password protected or something because i tried to access an image directly (eg. awstats/icon/other/vk.png) it shows up with a "Forbidden 403" error. I've changed all the permissions of the images to 755 and the other folder permission to "777" as well. So i don't know what is wrong.
jlasman
02-27-2005, 04:12 PM
This is a generic reply, but it may be applicable:
Is AWStats operating as from the cgi-bin directory? If so, is it linking to images in a cgi-bin directory?
You may not be allowing that.
In fact you probably aren't.
Jeff
Hmmm you're right, thanks for that.
Now how to do this....
rotjeknor
04-03-2005, 02:25 PM
Thanks for the script!
Some files are rwxrwxrwx. You could add to the awsetup script (add en upgrade) for some extra security: ;-)
-----
system("chmod 644 /home/$user/domains/$domain/public_html/cgi-bin/$awsdir/awstats.model.conf");
system("chmod -R 644 /home/$user/domains/$domain/public_html/cgi-bin/$awsdir/lang");
system("chmod -R 644 /home/$user/domains/$domain/public_html/cgi-bin/$awsdir/lib");
system("chmod -R 644 /home/$user/domains/$domain/public_html/cgi-bin/$awsdir/plugins");
system("chmod 755 /home/$user/domains/$domain/public_html/cgi-bin/$awsdir/lang");
system("chmod 755 /home/$user/domains/$domain/public_html/cgi-bin/$awsdir/lib");
system("chmod 755 /home/$user/domains/$domain/public_html/cgi-bin/$awsdir/plugins");
-----
Newbee
04-03-2005, 04:33 PM
is this script still ok to use? Has anyone used it recently without errors? thanks.
Newbee
04-03-2005, 05:40 PM
Yep just tried it and it seems to be working fine!
Internal Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request.
Please contact the server administrator, webmaster@****.info and inform them of the time the error occurred, and anything you might have done that may have caused the error.
More information about this error may be available in the server error log.
Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.
--------------------------------------------------------------------------------
Apache/1.3.31 Server at www.***** Port 80
---------------
What is wrong ? .... plase help me
jmstacey
04-10-2005, 11:28 AM
Make sure the the directory and file that the script is in has the correct permissions and ownter****p. 755 and user:user
alpha
04-11-2005, 09:47 PM
Has anyone tried this with FreeBSD 5.x + DA?
snk00sj
04-30-2005, 12:35 PM
very nice script, working flawless on a directadmin setup on debian, thanks for the work man !
@how@
05-01-2005, 06:42 AM
100% work
but Top 1 of 1 Total Countrie only Unresolved/Unknown
:(
If you have been using this script, it is very likely that stats have been incorrect (lower than the real figures) since the upgrade to DA 1.24
This is because webalizer is now rotating the apache logs daily, at 00:10 if i'm correct and awsetup up to 2.1 was setting a cron job at 03:15 AM .
The quick fix is to edit the user cronjobs and set them all before the rotation, at 00:00 would probably be early enough.
Awsetup 2.2 sets the cronjobs at 00:00 by default now.
I'm not too sure but I if you run DA 1.243 or above and the log rotation is turned off as explained here :
http://www.directadmin.com/features.php?id=507
This might do the trick as well, but cause some trouble to webalizer ??? So I would not suggest it.
I can modify this script to handle this cronjobs/crontime issue better but then it will only be one step closer to a plugin..... and there is already a pluggin which appears to be quite stable now Here (http://www.directadmin.com/forum/showthread.php?s=&threadid=3901&highlight=awstats)
What do you think ? the only major difference would be that it would use a not customised Awstats archive and would be installed in the user's directory rather than using symbolic links , the rest would work in a pretty simillar way ... is it really worth the coding time ?
Just in case ....
awsetup 2.2 is available, you can use it to install/remove/upgrade to AwStats 6.4 .
It also fixes some permissions for better security as someone suggested in this thread. The cronjob for new install is set to 00:00 by default. The -u option will NOT change the time of the cronjob.
Cheers
Miky
jlasman
07-17-2005, 11:04 PM
There's a great self-help community here, Miky.
If there needs to be a change (I bet there does; there've been a lot of complaints recently about the stats difference between AWStats and webalizer), and whoever wrote the plugin hasn't fixed it, then it may very well be time for a new plugin.
Has anyone attempted to contact the author of the existing plugin?
Jeff
TechNet
07-01-2008, 10:22 AM
Hello,
I am a newbie for Linux system administration.Could you please help me out for setting a cronjob for Awstats.
I wish to have a step to add a cronjob so to update the Awstats of the Linux CentOS server which includes all domains. I do not wish to go add cronjob for every single domain.
Please provide me the string and also please let me know the steps.
Thanks
TechNet
vBulletin® v3.8.4, Copyright ©2000-2010, Jelsoft Enterprises Ltd.