PDA

View Full Version : auto symlink to all created accounts



teedee
03-08-2004, 07:13 AM
Hi,

I have a reseller that wants to automatically create a symlink in all the new accounts they create, linking to a directory of php files in their account. They mainly sell a CMS and need this feature to enable them to update their clients CMS files by only modifying the files in 1 directory.

Any ideas on how I could go about setting this up ?


Thanks

TeeDee

DirectAdmin Support
03-08-2004, 11:23 AM
Hello,

You'll want to have a look at /usr/local/directadmin/scripts/custom/README

You can use the domain creation scripts to create whatever you want after each domain is created.

eg: /usr/local/directadmin/scripts/custom/domain_create_post.sh


#!/bin/sh

ln -s /home/reseller/global_scripts /home/$username/domains/$domain/public_html/global_scripts

exit 0;John

teedee
03-08-2004, 10:12 PM
Thanks John,

but would this create the sysmlink on all new created accounts ?
I would like it just to be for any accounts created by a specific reseller. Is this possible ?

DirectAdmin Support
03-09-2004, 11:31 AM
Hello,

For any actions you want to have happen, just put your script inside:

/usr/local/directadmin/scripts/custom/user_create_post.sh

The $creator environmental variable is passed for user creation, so you could just do a: if [ $creator = "bob" ]; then ....

OR, since it's run as root, in the domain_create_post.sh, you could just do:

creator = `cat /usr/local/directadmin/data/users/$username/user.conf |grep creator= |cut -d= -f2`

Then you can do the above: if [ $creator = "bob" ]; then

:)

John