Advertisement
Guest User

Untitled

a guest
Apr 28th, 2019
130
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 4.07 KB | None | 0 0
  1. #!/usr/bin/perl
  2.  
  3. # Author: Michael Stauber <mstauber@solarspeed.net>
  4. # Copyright 2006, Stauber Multimedia Design. All rights reserved.
  5.  
  6. $version = '2.0.0';
  7. $opt_c = "";
  8. $opt_h = "";
  9.  
  10. use lib "/usr/share/perl5/";
  11. use Getopt::Std;
  12.  
  13. &solbackup_erase_all_sites;
  14.  
  15. sub solbackup_erase_all_sites {
  16.         # Delete all sites:
  17.         system("/bin/rm -f /tmp/restore-is-underway");
  18.         system("rm -f /tmp/restore-dumplocation");
  19.         system("touch /tmp/restore-is-underway");
  20.  
  21.         system("ls -k1 /home/sites/ > /tmp/sitelist.txt");
  22.         $sitelist = "/tmp/sitelist.txt";
  23.         open(SCONFIG, $sitelist);
  24.         @list = <SCONFIG>;
  25.         close (SCONFIG);
  26.         foreach $site (@list) {
  27.                 $size = length($site);
  28.                 unless ($size < 3) {
  29.                         chomp $site;
  30.                         print "Deleting site $site:\n";
  31.                         system("/usr/sbin/cdelvsite --fqdn $site");
  32.                 }                                                                                                                                                                                                                                                        
  33.         }                                                                                                                                                                                                                                                                
  34.         system("rm -f /tmp/sitelist.txt");                                                                                                                                                                                                                              
  35.         # If you see this and wonder ... don't. cdelvsite often horribly fails at removing group or user directories ... <sigh>                                                                                                                                          
  36.         system("rm -Rf /home/.sites/[0-9]*");                                                                                                                                                                                                                            
  37.         system("cp -Rf /home/.users/112/ /tmp/");                                                                                                                                                                                                                        
  38.         system("rm -Rf /home/.users/");                                                                                                                                                                                                                                  
  39.         system("mkdir /home/.users/");                                                                                                                                                                                                                                  
  40.         system("chmod 755 /home/.users/");                                                                                                                                                                                                                              
  41.         system("mv /tmp/112 /home/.users/");                                                                                                                                                                                                                            
  42.         system("chown admin:users -R /home/.users/112/admin/");                                                                                                                                                                                                          
  43.         print "All sites have been deleted. \n";                                                                                                                                                                                                                        
  44. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement