|
Server : Apache/2.2.22 (Unix) mod_ssl/2.2.22 OpenSSL/1.0.0-fips mod_auth_passthrough/2.1 mod_bwlimited/1.4 System : Linux server.jackjohnson.com 2.6.32-279.5.2.el6.x86_64 #1 SMP Fri Aug 24 01:07:11 UTC 2012 x86_64 User : jackjohn ( 502) PHP Version : 5.3.17 Disable Function : NONE Directory : /proc/self/root/scripts/ |
Upload File : |
#!/usr/local/cpanel/3rdparty/bin/perl
# cpanel12 - mount_cleanup Copyright(c) 2006 cPanel, Inc.
# All Rights Reserved.
# copyright@cpanel.net http://cpanel.net
# This code is subject to the cPanel license. Unauthorized copying is prohibited
my $proc_mounts = '/proc/mounts';
exit if !-e $proc_mounts;
my $clean_all_virtfs = @ARGV && $ARGV[0] =~ m/force/i ? 1 : 0;
my %mounts;
if ( open my $mount_fh, '<', $proc_mounts ) {
while ( my $line = readline $mount_fh ) {
if ( $line =~ m/^\S+\s+(\S+)/ ) {
my $target = $1;
if ( exists $mounts{$target} ) {
$mounts{$target}++;
next;
}
next if !-d $target;
$mounts{$target} = 1;
}
}
close $mount_fh;
}
foreach my $mount ( keys %mounts ) {
next if $mount !~ m/^\S+\/virtfs\//;
my $start = 2;
if ($clean_all_virtfs) {
$start = 1;
}
else {
next if $mounts{$mount} < 2;
}
foreach my $count ( $start .. $mounts{$mount} ) {
system 'umount', $mount;
}
}