PDA

View Full Version : Where are the custom scripts??



louie55
03-20-2005, 02:38 PM
I have read a lot about custom scripts in these forums like domain_create_post.sh etc... But, where are these script files on the server?? I don't see them anywhere. Do I have to create them myself?? If so, where do I create them?

Also, does someone have a link to a list of the different script files that are possible and when each one runs.

I've searched the forums for this info but have been unsuccessful.

Thanks.

OxnardMontalvo
03-21-2005, 08:52 AM
/usr/local/directadmin/scripts/custom

=C=

louie55
03-21-2005, 08:58 AM
Thanks. Now, where can find a list of the different possible ones?? Thanks.

Louie

OxnardMontalvo
03-21-2005, 09:17 AM
/usr/local/directadmin/scripts/custom/README

drmike
03-21-2005, 01:27 PM
Strange. My custom folder is empty.

-drmike

OxnardMontalvo
03-21-2005, 01:38 PM
The contents of this file will map what script names will be associated with what commands.

##########################################

domain_create_pre.sh - Runs BEFORE a domain is created
domain_create_post.sh - Runs AFTER a domain is created
domain_destroy_pre.sh - Runs BEFORE a domain is destroyed
domain_destroy_post.sh - Runs AFTER a domain is destroyed

environmental variables:
bandwidth=# or unlimited
cgi=ON or OFF
defaultdomain=yes or no
domain=domain.com
ssl=ON or OFF
suspended=yes or no
username=ownerofdomain

##########################################

subdomain_create_pre.sh - Runs BEFORE a subdomain is created, but after it's confirmed.
If this script returns a non-zero value, the creation is aborted.
subdomain_create_post.sh - Runs AFTER the subdomain is created.
subdomain_destroy_pre.sh - Runs BEFORE a subdomain is destroyed. If this script returns
a non-zero value, the destruction is aborted
subdomain_destroy_post.sh - Runs AFTER the subdomain is destroyed.

environmental variables:
username=ownerofdomain
domain=domain.com
subdomain=sub
contents=1 or 0 - only for destroy. Specifies that the directory and contents are being removed.

##########################################

user_create_pre.sh - Runs BEFORE the user is created, but after it's confirmed.
If this script returns anything but zero, the creation is aborted
user_create_post.sh - Runs AFTER the user is created.
user_destroy_pre.sh - Runs BEFORE the use is destroyed. If this script returns anything
but zero, the destruction is aborted.
user_destroy_post.sh - Runs AFTER the user is destroyed.
user_modify_post.sh - Runs AFTER the user is modified.

environmental variables:
account=ON or OFF
aftp=ON or OFF
bandwidth=# or unlimited
cgi=ON or OFF
creator=username
dnscontrol=ON or OFF
docsroot=./data/skins/default (relative path to document root)
domain=domain.com
domainptr=# or unlimited
email=email@domain.com
ftp=# or unlimited
ip=1.2.3.4
mysql=# or unlimited
nemailf=# or unlimited
nemailml=# or unlimited
nemailr=# or unlimited
nemails=# or unlimited
ns1=ns1.domain.com
ns2=ns2.domain.com
nsubdomains=# or unlimited
package=packagename
passwd=the password entered
quota=# or unlimited
sentwarning=no (refers to resource usage limits notification emails)
skin=default (name of skin)
ssh=ON or OFF
ssl=ON or OFF
suspend_at_limit=ON or OFF
suspended=no
username=username
usertype=user or reseller or admin
vdomains=# or unlimited
zoom=100 (completely useless value token for the css zoom feature)

##########################################

email_create_pre.sh - Runs BEFORE the virtual email is created, but after it's confirmed.
If this script returns anything but zero, the creation is aborted
email_create_post.sh - Runs AFTER the email is created

environment values:
user=bob
domain=domain.com
passwd=secret
passwd2=secret
username=username

##########################################

email_destroy_pre.sh - Runs AFTER virtual email account is deleted.

environement values:
user=bob
domain=domain.com
username=username

##########################################

email_change_pass_post.sh - Runs AFTER a virtual pop account password is changed.

#username and quota are not passed if the password change is done using "/CMD_CHANGE_EMAIL_PASSWORD"

environmental values:
user=bob
domain=domain.com
passwd=newsecret

username=username
quota=#

##########################################

dns_write_post.sh - Runs AFTER a dns zone is written (/var/named/domain.com.db)

environmental values:
A : list of a records
CNAME : list of cname records
MX : list of mx records
NS : list of ns records
PTR : list of ptr records
SERIAL : the serial used in the zone
EMAIL : authoritative email
NS1 : authoritative ns zone.
DOMAIN : domain name of the zone
SERVER_IP : server IP
A_TIME : ttl for A records
CNAME_TIE : ttl for CNAME records
NS_TIME : ttl for NS records
PTR_TIME : ttl for PTR records
see http://www.directadmin.com/features.php?id=450 for more info

drmike
03-21-2005, 01:42 PM
Originally posted by OxnardMontalvo
The contents of this file will map what script names will be associated with what commands.

*chuckle*

Is there a reason why you posted the README file? :)

-drmike

OxnardMontalvo
03-21-2005, 01:58 PM
You said your custom dir was empty. I took that to mean that you couldn't find the README file. So I posted it for you. If you mean that it's empty because there are no scripts in it then, well it's supposed to be and you need to go dig up the documentation on this and learn how it works.

Sorry, I'll leave you alone now.

=C=

drmike
03-21-2005, 02:06 PM
Originally posted by OxnardMontalvo
Sorry, I'll leave you alone now.

Nah, you just threw me. I should have said all I had was the README file. Even did a locate -u and searched for the scripts. Still can't see them. Kind of stange.....

Thanks,
-drmike

nobaloney
03-22-2005, 11:00 AM
You won't have any custom scripts unless you create them there.

Jeff

Chrysalis
03-24-2005, 10:22 AM
excellent post OxnardMontalvo

bookmarking this

louie55
03-24-2005, 01:23 PM
I'd just like to say, thanks for the posts OxnardMontalvo, and I successfully created a user_create_post.sh script and it works perfectly. Thanks again.

Louie

louie55
03-24-2005, 01:24 PM
Oh, and in case anybody is interested, the script I created automatically installs the BBClone (www.bbclone.de) web statistics program into every users site. It is very nice.

Louie

OxnardMontalvo
03-25-2005, 07:16 AM
Originally posted by louie55
I'd just like to say, thanks for the posts OxnardMontalvo, and I successfully created a user_create_post.sh script and it works perfectly. Thanks again.

Louie

Glad it worked. Happy to help when I can. :)

=C=

jodasi
04-08-2005, 08:06 AM
Anyone will please set an custom script example?

OxnardMontalvo
04-08-2005, 08:34 AM
#!/bin/sh

# domain_create_post.sh - Runs AFTER a domain is created

#
# Create awstats
#
/usr/local/directadmin/plugins/awstats/hooks/awstatsinstall.php -id ${domain}

This is one of mine.

=C=

jodasi
04-08-2005, 08:52 AM
How did you call it?

A link on the directadmin interface? or its called automatically after the domain creation?

I'm trying to figure it out how plugins works.

OxnardMontalvo
04-08-2005, 08:57 AM
DA checks for it's existence and if it's there (and executable) it will run it.

NOTE: These are custom scripts. Not plugins. Huge difference.

Custom scripts are hooks in the DA process where you can add your own code to be called. Plugins get installed into DA to add functionality and interfaces.

=C=