MOON
Server: Apache/2.2.21 (Unix) mod_ssl/2.2.21 OpenSSL/0.9.8e-fips-rhel5 mod_auth_passthrough/2.1 mod_bwlimited/1.4
System: Linux vps.panamaemb.org.sg 3.10.0-1160.80.1.vz7.191.4 #1 SMP Thu Dec 15 20:31:06 MSK 2022 x86_64
User: panama (500)
PHP: 5.2.17
Disabled: NONE
Upload Files
File: //proc/3/task/3/cwd/proc/3/root/scripts/mount_cleanup
#!/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;
    }
}