PDA

View Full Version : Automate things on user signup



jep
06-03-2004, 03:45 PM
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
06-03-2004, 06:08 PM
/usr/local/directadmin/scripts/custom/README



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

Chris

jep
06-04-2004, 02:18 AM
Thanks *again* Prowebuk ;)

jep
06-04-2004, 04:38 AM
Found it. The brackets did the trick. :D

ProWebUK
06-04-2004, 05:39 AM
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:



setup_user_awstats() {


And at the end of the script:



}


then as your DA script have:



#!/bin/sh
source /path/to/script.sh
setup_user_awstats $domain $username


Chris