#!/usr/bin/perl # ----------------------------------------------------------------------------------------- # This script is meant to be run from the /home directory as root. It recreates all of # www static links in the file system under /home/username. The www static links point to # the public_html directory. # # This script is handy for fixing www links that are missing or removed from CPanel servers. # # ----------------------------------------------------------------------------------------- # To download other useful scripts, or to find web hosting for your web site visit: # # http://www.assortedinternet.com/ # ----------------------------------------------------------------------------------------- # # ----------------------------------------------------------------------------------------- # Author: Brian Teeter # Date: $Date: 2004/05/11 02:44:45 $ # Version: $Revision: 1.1 $ # ----------------------------------------------------------------------------------------- #!/usr/bin/perl # ---------------------------------------------------------------- # Declare variables we will use below: # ---------------------------------------------------------------- my $exec1; my $exec2; # ---------------------------------------------------------------- # Ensure we are in the home directory: # ---------------------------------------------------------------- `cd /home`; # ---------------------------------------------------------------- # Get all of the usernames assuming the directory names are the # same as the usernames: # ---------------------------------------------------------------- my @ls = `ls -1`; chop @ls; for ($i = 0; $i < $#ls; $i++) { # ---------------------------------------------------------------- # Remove the existing www directory from this user account: # ---------------------------------------------------------------- $exec1 = "rm -Rf /home/$ls[$i]/www"; print("Executing: $exec1 \n"); system("$exec1"); # ---------------------------------------------------------------- # Establish the www static link to public_html: # ---------------------------------------------------------------- $exec2 = "ln -s /home/$ls[$i]/public_html /home/$ls[$i]/www"; print("Executing: $exec2 \n"); system("$exec2"); } exit;