Shell File Manager
Current Path : /scripts/ |
|
Current File : //scripts/precpbackup |
#!/usr/bin/perl
use strict;
my $v = 1 if ($ARGV[0] =~ /^-(|-)(v|verbose)$/i);
my $location = "/backup/cpbackup/sbr";
if ( !-d $location ) {
print "SBnR folder not found.\n" if ( $v );;
exit 0;
}
my %mounts = ();
foreach my $mount ( `cat /proc/mounts` ) {
next if ($mount !~ m/^archivemount\s+(\S+)\s/);
$mounts{$1} = 1;
}
exit 0 and print "No SBnR mounts found.\n" if ( %mounts == () && $v );
my $user = '';
opendir(SBR, $location);
foreach my $dir ( readdir SBR ) {
next if ( $dir =~ m/^\./ );
$user = $1 if ($dir =~ m/^(\w+)\./);
print "Checking $user in $location/$dir/$user\n" if ( $v );
if ( $mounts{"$location/$dir/$user/homedir"} ) {
print "$dir/$user/homedir found, unmounting..." if ( $v );
system("umount -l $location/$dir/$user/homedir\n") == 0 or die "Can't unmount $location/$dir/$user/homedir\n";
print "done.\n" if ( $v );
}
if ( $mounts{"$location/$dir"} ) {
print "$dir found, unmounting..." if ( $v );
system("umount -l $location/$dir\n") == 0 or die "Can't unmount $location/$dir/$user/homedir\n";
print "done.\n" if ( $v );
}
}
closedir SBR;
Shell File Manager Version 1.1, Coded By Shell
Email: [email protected]