Community Forums
Connect with us on LinkedIn
+ Reply to Thread
Results 1 to 2 of 2
  1. #1
    Member d-woo's Avatar
    Join Date
    Aug 2003
    Posts
    86

    Default Script to copy Customized Error Pages to all users

    Hi guys,

    I need help with some syntax.

    I have some customized error pages:

    /error_master/400.shtml
    /error_master/401.shtml
    /error_master/403.shtml
    /error_master/404.shtml


    that I would like to copy to the public_html of all of my users in /var/cpanel/users

    I am basing this off of the script given by forum member brianoz on this post http://forums.cpanel.net/showthread.php?t=57111

    Can you please check my syntax?

    Code:
    cd /home
    for user in `ls /var/cpanel/users`
    do
         test ! -d $user && continue
    
    	cp /error_master/400.shtml /home/$user/public_html -R
    	chown $user:$user /home/$user/public_html/400.shtml
    
    	cp /error_master/401.shtml /home/$user/public_html -R
    	chown $user:$user /home/$user/public_html/401.shtml
    
    	cp /error_master/403.shtml /home/$user/public_html -R
    	chown $user:$user /home/$user/public_html/403.shtml
    
    	cp /error_master/404.shtml /home/$user/public_html -R
    	chown $user:$user /home/$user/public_html/404.shtml
    
    	cp /error_master/500.shtml /home/$user/public_html -R
    	chown $user.$user /home/$user/public_html/500.shtml
    
    
         echo $user complete
    done
    I would save it as /home/error_insert

    Would I run it by exectuing ./error_insert in /home ?

  2. #2
    Member d-woo's Avatar
    Join Date
    Aug 2003
    Posts
    86

    Default

    okay..got this working

    1. log in SSH as root
    cd /

    2. create the file
    touch install_error_files
    pico install_error_files

    3.insert/paste the code (by right-clicking in Putty)
    Code:
    #! /bin/sh
    cd /home
    for user in `ls /var/cpanel/users`
    do
         test ! -d $user && continue
    
    	cp /error_master/400.shtml /home/$user/public_html -R
    	chown $user:$user /home/$user/public_html/400.shtml
    
    	cp /error_master/401.shtml /home/$user/public_html -R
    	chown $user:$user /home/$user/public_html/401.shtml
    
    	cp /error_master/403.shtml /home/$user/public_html -R
    	chown $user:$user /home/$user/public_html/403.shtml
    
    	cp /error_master/404.shtml /home/$user/public_html -R
    	chown $user:$user /home/$user/public_html/404.shtml
    
    	cp /error_master/500.shtml /home/$user/public_html -R
    	chown $user.$user /home/$user/public_html/500.shtml
    
    
         echo $user complete
    done
    4. Save and Exit Pico
    Ctrl X >> Y >> {enter}

    5. chmod the file as 700
    chmod 700 install_error_files

    4. Run the script
    ./install_error_files

    Worked like a charm!

Similar Threads & Tags
Similar threads

  1. Copy an account and preserve customized DNS settings?
    By JamesAB in forum cPanel and WHM Discussions
    Replies: 7
    Last Post: 04-26-2010, 11:03 PM
  2. mysql web pages only loading for Win NT/9x/Mac users
    By TheWebHead in forum cPanel and WHM Discussions
    Replies: 2
    Last Post: 07-17-2006, 12:23 PM
  3. copy script didnt copy mailman lists
    By jnagro in forum cPanel and WHM Discussions
    Replies: 1
    Last Post: 12-11-2004, 02:41 AM
  4. Creating error pages for users?
    By grey_fox in forum cPanel and WHM Discussions
    Replies: 4
    Last Post: 09-08-2004, 09:03 PM
  5. Adding Custom Error Pages for non-existant pages
    By YukFoo in forum cPanel and WHM Discussions
    Replies: 3
    Last Post: 09-16-2002, 03:07 AM
Linkedin       Facebook       Twitter       RSS       Flickr       YouTube