晋太元中,武陵人捕鱼为业。缘溪行,忘路之远近。忽逢桃花林,夹岸数百步,中无杂树,芳草鲜美,落英缤纷。渔人甚异之,复前行,欲穷其林。 林尽水源,便得一山,山有小口,仿佛若有光。便舍船,从口入。初极狭,才通人。复行数十步,豁然开朗。土地平旷,屋舍俨然,有良田、美池、桑竹之属。阡陌交通,鸡犬相闻。其中往来种作,男女衣着,悉如外人。黄发垂髫,并怡然自乐。 见渔人,乃大惊,问所从来。具答之。便要还家,设酒杀鸡作食。村中闻有此人,咸来问讯。自云先世避秦时乱,率妻子邑人来此绝境,不复出焉,遂与外人间隔。问今是何世,乃不知有汉,无论魏晋。此人一一为具言所闻,皆叹惋。余人各复延至其家,皆出酒食。停数日,辞去。此中人语云:“不足为外人道也。”(间隔 一作:隔绝) 既出,得其船,便扶向路,处处志之。及郡下,诣太守,说如此。太守即遣人随其往,寻向所志,遂迷,不复得路。 南阳刘子骥,高尚士也,闻之,欣然规往。未果,寻病终。后遂无问津者。
|
Server : Apache System : Linux srv.rainic.com 4.18.0-553.47.1.el8_10.x86_64 #1 SMP Wed Apr 2 05:45:37 EDT 2025 x86_64 User : rainic ( 1014) PHP Version : 7.4.33 Disable Function : exec,passthru,shell_exec,system Directory : /scripts/ |
Upload File : |
#!/usr/local/cpanel/3rdparty/bin/perl
# cpanel - scripts/cpbackup_transport_file Copyright 2022 cPanel, L.L.C.
# All rights reserved.
# copyright@cpanel.net http://cpanel.net
# This code is subject to the cPanel license. Unauthorized copying is prohibited
package scripts::cpbackup_transport_file;
use strict;
use warnings;
use parent qw( Cpanel::HelpfulScript );
use Cpanel::Debug ();
use Cpanel::Logger ();
use Cpanel::Backup::Config ();
=encoding utf-8
=head1 NAME
scripts::cpbackup_transport_file
=head1 SYNOPSIS
cpbackup_transport_file [ --transport <transport_id> --upload </full/path/to/file.ext> | --debug ]
cpbackup_transport_file [ --transport <transport_id> --download <path/on/remote/file.ext> --download-to </path/on/local/file.ext> | --debug ]
cpbackup_transport_file [ --help ]
This script will allow you to upload or download any file via the requested backup transport outside of the normal queued process.
As such, it uploads things slightly differently. The file you request to upload will go to a subfolder of the 'path' you configured
for the transport you specify named 'manual_backup'. Example of how it should look uploaded:
myBackups/manual_backup/somefile.ext
Using this script can be useful in debugging transport failures, as there's two benefits here:
* Realtime streaming of all output without having to parse a log file (with option to obtain debugging output)
* No need to wait on backups first -- just provide a path to the file.
Currently, no effort is made in this script to update backup metadata or the transport history DBs.
This is because this script is provided as a convenience to testing, not as a regular part of the backup process.
*NOTE*: On transports that split files up due to necessity (like BackBlaze B2), the --download arg should represent the remote filename
as if it *was not* uploaded in parts. The backup transport code itself will know what to do with that to reconstruct the split file.
=head1 DESCRIPTION
See SYNOPSIS.
=cut
sub _OPTIONS {
return qw( transport=s upload=s download=s download-to=s debug );
}
exit __PACKAGE__->new(@ARGV)->script() unless caller();
sub script {
my ($self) = @_;
my $transport_id = $self->getopt('transport');
my $upload_path = $self->getopt('upload');
my $download_remote = $self->getopt('download');
if ( !$transport_id ) {
print "\n" . $self->help();
return 1;
}
if ( $download_remote && $upload_path ) {
print "--download and --upload are mutually exclusive options\n\n" . $self->help();
return 1;
}
$Cpanel::Debug::level = 9999 if ( $self->getopt('debug') );
# Validate the transport_id
require Cpanel::Backup::Transport;
my $transports = Cpanel::Backup::Transport->new();
my $transport_configs = $transports->get_enabled_destinations();
my $matching_cfg = $transport_configs->{$transport_id};
if ( !$matching_cfg ) {
print "\nNo backup transports exist that are enabled and match the supplied transport. Exiting...\n";
return 1;
}
if ($upload_path) {
print "Attempting transport of '$upload_path' using transport ID '$transport_id''.\n";
# Note, the 'Cpanel::Backup::Queue::transport_backup' package/namespace is also defined by this package, so thus it is imported.
require Cpanel::Backup::Queue; # PPI USE OK -- Cpanel::Backup::Queue::transport_backup is defined there
require Cpanel::Backup::Config;
require File::Basename;
my $backup_conf = Cpanel::Backup::Config::load();
my $args = {
local_path => $upload_path,
remote_path => 'manual_backup/' . File::Basename::basename($upload_path),
local_files => $upload_path,
keep_local => 1,
session_id => 'MANUAL_RUN',
type => $backup_conf->{'BACKUPTYPE'},
cmd => 'do_the_dew',
transport => $transport_id,
};
# Log to stdout
my $logger = Cpanel::Logger->new( { 'use_no_files' => 1 } );
Cpanel::Backup::Queue::transport_backup->new()->process_task( $args, $logger ); # PPI NO PARSE -- See comment below
# The import of Cpanel::Backup::Queue above via require causes the
# namespace in question here to exist, as it is the kind of package
# which defines multiple packages in one file, as perl allows you to
# do. As this is the "common" design of TaskProcessor modules,
# this is not only expected but appropriate.
}
elsif ($download_remote) {
my $download_local = $self->getopt('download-to');
require Cpanel::Transport::Files;
my $transporter = Cpanel::Transport::Files->new( $matching_cfg->{'type'}, $matching_cfg );
print "Now attempting download of the requested file...\n";
my $transporter_response = $transporter->get( $download_remote, $download_local );
if ( !$transporter_response->{'success'} ) {
print STDERR "[ERROR] $transporter_response->{'msg'}\n";
return 2;
}
}
else {
print "\n" . $self->help();
return 1;
}
return 0;
}
0;