DA scripting help needed

teedee

Verified User
Joined
Oct 30, 2003
Messages
152
Hi,

I need someone that can put a script onto my server that auto creates 3 symlinks and copies a 404 page over whenever a new account is added by a certain reseller.

DA support staff told me this can be done using
/usr/local/directadmin/scripts/custom/user_create_post.sh

But I just can't get the thing to work....... :(

PM me if you can do this and also let me know how much you would want for doing this.

Thanks

TeeDee
 
Very simple script... Let me know the 3 symlinks and where you want the 404 from/to and i'll get it written up and on here :)

Chris
 
ok,
the directories to be symlinked from are

/home/prymid/public_html/js
/home/prymid/public_html/images
/home/prymid/public_html/styles

the 404 is located at /home/prymid/public_html/404.php

so whenever reseller "xyz" creates a new account these directories are symlinked to the new account /home/username/public_html/ and the 404 copied to public_html and chmoded to 755

ALso (I forgot :D) need to add a .htaccess so that 404.php works or add an ErrorDocument 404 /404.php to the httpd.conf

Hope that makes sense, not to good at explaining myself :D

Thanks
 
teedee said:
the directories to be symlinked from are

/home/prymid/public_html/js
/home/prymid/public_html/images
/home/prymid/public_html/styles

pointing to?

ls /home/user/domains/domain.com/public_html/js
js -> /home/prymid/public_html.js

?

teedee said:
the 404 is located at /home/prymid/public_html/404.php

so whenever reseller "xyz" creates a new account these directories are symlinked to the new account /home/username/public_html/ and the 404 copied to public_html and chmoded to 755

ALso (I forgot :D) need to add a .htaccess so that 404.php works or add an ErrorDocument 404 /404.php to the httpd.conf

Hope that makes sense, not to good at explaining myself :D

Thanks

Code:
#!/bin/sh

# Create the 3 symlinks
# 1:
ln -s /home/${username}/domains/${domain}/public_html/js /home/prymid/public_html/js

# set symlink ownership to user so they can remove this
chown ${username}:${username} /home/${username}/domains/${domain}/public_html/js

# 2:
ln -s /home/${username}/domains/${domain}/public_html/images /home/prymid/public_html/images

# set symlink ownership to user so they can remove this
chown ${username}:${username} /home/${username}/domains/${domain}/public_html/images

#3
# 2:
ln -s /home/${username}/domains/${domain}/public_html/styles /home/prymid/public_html/styles

# set symlink ownership to user so they can remove this
chown ${username}:${username} /home/${username}/domains/${domain}/public_html/styles

# create an errordocs directory for user:
mkdir /home/${username}/domains/${domain}/public_html/error-docs

# set ownership of errordocs so it may be removed by user
chown ${username}:${username} /home/${username}/domains/${domain}/public_html/error-docs

# Copy specified error pages to error-docs folder:
# 404.html
cp [B]/path/to/404.html[/B] /home/${username}/domains/${domain}/public_html/error-docs/

# if you have any other error pages copy the above line and replace 404.html with your error page - you will need to specify others in the .htaccess also

# copy .htaccess to users main directory
cp [B]/path/to/.htaccess[/B] /home/${username}/domains/${domain}/public_html/

Try it out on a test domain and let me know if you run into any problems :)

Chris
 
the

/home/prymid/public_html/js
/home/prymid/public_html/images
/home/prymid/public_html/styles

files are already in place and need to be linked to all new domains.

where can I specify that this rules only apply if accounts created from a specific reseller ?

Thanks again

(getting more and more confused)

TeeDee
 
Code:
if [ ${usertype} == "reseller" ]
then

if [ ${username} == "[B]test[/B]" ]
then

# Create the 3 symlinks
# 1:
ln -s /home/${username}/domains/${domain}/public_html/js /home/prymid/public_html/js

# set symlink ownership to user so they can remove this
chown ${username}:${username} /home/${username}/domains/${domain}/public_html/js

# 2:
ln -s /home/${username}/domains/${domain}/public_html/images /home/prymid/public_html/images

# set symlink ownership to user so they can remove this
chown ${username}:${username} /home/${username}/domains/${domain}/public_html/images

#3
# 2:
ln -s /home/${username}/domains/${domain}/public_html/styles /home/prymid/public_html/styles

# set symlink ownership to user so they can remove this
chown ${username}:${username} /home/${username}/domains/${domain}/public_html/styles

# create an errordocs directory for user:
mkdir /home/${username}/domains/${domain}/public_html/error-docs

# set ownership of errordocs so it may be removed by user
chown ${username}:${username} /home/${username}/domains/${domain}/public_html/error-docs

# Copy specified error pages to error-docs folder:
# 404.html
cp [B]/path/to/404.html[/B] /home/${username}/domains/${domain}/public_html/error-docs/

# if you have any other error pages copy the above line and replace 404.html with your error page - you will need to specify others in the .htaccess also

# copy .htaccess to users main directory
cp [B]/path/to/.htaccess[/B] /home/${username}/domains/${domain}/public_html/

fi
fi
 
Hi,

I am getting "Error with custom script: /usr/local/directadmin/scripts/custom/user_create_post.sh"
unfortunately it does not say what error....

TeeDee
 
Check the DA error log... not sure if it logs the errors from the custom scripts but worth a check ;)

Chris
 
Code:
if [ ${usertype} == "reseller" ]
then

if [ ${username} == "[B]test[/B]" ]
then

# Create the 3 symlinks
# 1:
ln -s /home/prymid/public_html/js /home/${username}/domains/${domain}/public_html/js

# set symlink ownership to user so they can remove this
chown ${username}:${username} /home/${username}/domains/${domain}/public_html/js

# 2:
ln -s /home/prymid/public_html/images /home/${username}/domains/${domain}/public_html/images

# set symlink ownership to user so they can remove this
chown ${username}:${username} /home/${username}/domains/${domain}/public_html/images

# 3:
ln -s /home/prymid/public_html/styles /home/${username}/domains/${domain}/public_html/styles

# set symlink ownership to user so they can remove this
chown ${username}:${username} /home/${username}/domains/${domain}/public_html/styles

# create an errordocs directory for user:
mkdir /home/${username}/domains/${domain}/public_html/error-docs/

# set ownership of errordocs so it may be removed by user
chown ${username}:${username} /home/${username}/domains/${domain}/public_html/error-docs

# Copy specified error pages to error-docs folder:
# 404.html
cp [B]/path/to/404.html[/B] /home/${username}/domains/${domain}/public_html/error-docs/

# if you have any other error pages copy the above line and replace 404.html with your error page - you will need to specify others in the .htaccess also

# copy .htaccess to users main directory
cp [B]/path/to/.htaccess[/B] /home/${username}/domains/${domain}/public_html/

fi
fi

Few problems I noticed... should be ok now :)

Chris
 
Hi,

Still getting error

"Error with custom script: /usr/local/directadmin/scripts/custom/user_create_post.sh"

:( :(
 
Re: What Next?!?!

TMC said:
Hey guys, please don't stop there!

I'm sure this thread stopped here because nobody wanted to say the obvious. Someone forgot to make sure the file permissions where 755.
 
Back
Top