PDA

View Full Version : DA scripting help needed


teedee
05-18-2004, 05:18 AM
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

ProWebUK
05-18-2004, 06:40 AM
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

teedee
05-18-2004, 06:52 AM
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

ProWebUK
05-18-2004, 07:23 AM
Originally posted by teedee
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

?

Originally posted by teedee
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


#!/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 /path/to/404.html /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 /path/to/.htaccess /home/${username}/domains/${domain}/public_html/


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

Chris

teedee
05-18-2004, 07:35 AM
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

ProWebUK
05-18-2004, 08:22 AM
if [ ${usertype} == "reseller" ]
then

if [ ${username} == "test" ]
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 /path/to/404.html /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 /path/to/.htaccess /home/${username}/domains/${domain}/public_html/

fi
fi

teedee
05-18-2004, 11:23 PM
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

ProWebUK
05-19-2004, 07:48 AM
Check the DA error log... not sure if it logs the errors from the custom scripts but worth a check ;)

Chris

teedee
05-19-2004, 02:55 PM
can't see anything in logs :(

ProWebUK
05-19-2004, 03:22 PM
if [ ${usertype} == "reseller" ]
then

if [ ${username} == "test" ]
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 /path/to/404.html /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 /path/to/.htaccess /home/${username}/domains/${domain}/public_html/

fi
fi


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

Chris

teedee
05-26-2004, 01:16 AM
Hi,

Still getting error

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

:( :(

TMC
09-09-2004, 10:11 PM
Hey guys, please don't stop there!

thuskey
09-21-2004, 07:18 PM
Originally posted by TMC
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.

TMC
09-22-2004, 02:14 AM
*LOL* Seriously???

And did it really take 8 days to fix???

:cool: