Automate things on user signup

jep

Verified User
Joined
Nov 12, 2003
Messages
79
Hi guys,

I've made a nice script to setup awstats for users. The syntax is:

makeawstats $domain.com $username

Because my client adds a lot of domains, he wants me to make something to automate this when I add a new user.

How can I do this? I saw there is some script that executes on user-add, but I aldo need the right variables. ;)

Thanks!
 

ProWebUK

Verified User
Joined
Jun 9, 2003
Messages
2,326
Location
UK
/usr/local/directadmin/scripts/custom/README

Code:
#!/bin/sh
(set your variables)
sh /path/to/awstats domain user

Chris
 

jep

Verified User
Joined
Nov 12, 2003
Messages
79
Found it. The brackets did the trick. :D
 
Last edited:

ProWebUK

Verified User
Joined
Jun 9, 2003
Messages
2,326
Location
UK
DA passes the variables to the script itself... what I would suggest is...

keep your script for manual use, make a copy and instead of having it run like:

./script domain user

replace the $1 / $2 vars for them in the script, and replace them with $domain and $username

Once you have done that, you will already have the username/password passed to the script, and wont have to run it like ./script user domain.

If you wanted it as a seperate file, the easiest way would be

add to the top of the script:

Code:
setup_user_awstats() {
And at the end of the script:

Code:
}
then as your DA script have:

Code:
#!/bin/sh
source [b]/path/to/script.sh[/b]
setup_user_awstats $domain $username
Chris
 
Top