AWStats 6.1 - easy install/remove script here.

Miky

Verified User
Joined
Jun 22, 2004
Messages
34
Location
Australia
AWStats 6.4 - 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
 
Last edited:
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 ;)
 
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
 
Last edited:
i ran the script but it didn't install the files in the right directory. What did I do wrong?
 
Turbo M said:
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
 
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.
 
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
 
Awesome, thanks

This is awesome, worked perfectly, just what I needed after spending 2hrs reading these forums trying to get webalizer to work....
 
ircman said:
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 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
 
Miky said:
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
 
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...
 
awsetup v2.0 for awstats 6.2

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
 
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
 
Last edited:
Back
Top