Where are the custom scripts??

louie55

Verified User
Joined
May 4, 2004
Messages
116
Location
Nebraska
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.
 
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 protected]
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
 
OxnardMontalvo said:
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
 
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=
 
OxnardMontalvo said:
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
 
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
 
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
 
louie55 said:
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=
 
#!/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=
 
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.
 
Last edited:
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=
 
Last edited:
/usr/local/directadmin/scripts/custom

=C=
Hello Oxnard,

Am new to DirectAdmin, currently am facing the challenge of locate that script file, my aim to to allow shared IP to all reseller account. I read ssome article on internet that suggest to add code in this format to that script file.

#!/bin/sh
IPL=/usr/local/directadmin/data/users/$username/ip.list
SERVER=1.2.3.4
SHARED=1.2.3.5

function add()
{
echo $1 >> ${IPL}
}

if [ -s ${IPL} ]; then
STR="perl -pi -e \'s/^${SERVER}\\$/${SHARED}/\' ${IPL}"
eval ${STR}
echo "Swapped server IP ${SERVER} with shared IP ${SHARED} for $username";

add 1.2.3.6
#add 1.2.3.7
fi
exit 0;

And i tried to ls directory in my VPS server to didn't have that directory, also i checked in my DirectAdmin web control panel I didn't see that directory after login as admin, then user level then file manager.

Kindly am asking for help to steps to locates that file and add those code,

Thanks,
 
Please create a new thread for your issue and do not up ancient posts from 16 years old. Too much is changed in that time.
 
Back
Top