$ ./1.test.1.pl title is 1.test. path1 is /home/hogan/5.scripts/1.test. abs is /home/hogan/5.scripts/1.test./1.test.1.pl ini path is /home/hogan/Documents/html_template_data/6.values.ini $VAR1 = bless( { 'my_sftp' => { 'key_path' => '/home/hogan/.ssh/id_rsa', 'domain' => '164.90.158.33', 'username' => 'fred', 'port' => '22' }, } }, 'Config::Tiny' ); values are 164.90.158.33 fred 22 OpenSSH_7.6p1 Ubuntu-4ubuntu0.3, OpenSSL 1.0.2n 7 Dec 2017 debug1: Reading configuration data /etc/ssh/ssh_config ... debug1: Authentication succeeded (publickey). Authenticated to 164.90.158.33 ([164.90.158.33]:22). debug1: channel 0: new [client-session] ... debug1: Sending subsystem: sftp object created, back with caller word is 1.test. dir2 is /var/www/html/perlmonks 1.test.1.html 1.test.3.html 1.test.2.html 1.test.1.css files are 1.test.1.html 1.test.3.html 1.test.2.html 1.test.1.css old num is 3 Make rus captions(y/n)?: y matching are b.txt rus_munge is /home/hogan/5.scripts/1.test./template_stuff/translations/trans.15-10-2020-22-01-35.txt rus_path is /home/hogan/5.scripts/1.test./template_stuff/ruscaptions/b.txt Get other translations(y/n)?: n remote_dir is 1.test.4 result is
Building new site with perl template.
Neue Site mit Perl-Vorlage erstellen.
##
# upload images
my $image_dir = $vars{"image_dir"};
say "image dir is $image_dir";
my $return2 = createDir( $image_dir, $sftp );
say "return2 is $return2";
####
sub createDir {
use 5.011;
use Net::SFTP::Foreign;
my ( $dirName, $sftp ) = @_;
if ( $sftp->test_e($dirName) ) {
if ( !$sftp->test_d($dirName) ) {
print "Remove file(y/n)?: ";
my $prompt1 = ;
chomp $prompt1;
if ( $prompt1 eq ( "y" | "Y" ) ) {
if ( fork() == 0 ) {
# arm the alarm clock
alarm(35);
say "you got 35 seconds for process $$";
# create a child process
my $return3 = $sftp->remove($dirName);
say "return3 is $return3";
createDir($dirName, $sftp);
say "process $$ executed here";
exit(0);
}
}
#end if that tests !$sftp->test_d($dirName) next brace
}
if ( $sftp->test_d($dirName) ) {
say "execution was here";
return "Directory $dirName already exists!";
}
else {
say "Can't create $dirName because there's a file in the way!";
handleDirCreateError( @_, $sftp->error );
}
}
my $success = $sftp->mkdir($dirName)
or handleDirCreateError( @_, $sftp->error );
return $success;
}
## ##
sub handleDirCreateError {
use 5.011;
use Net::SFTP::Foreign;
my ( $dirName, $sftp, $error ) = @_;
say "parameter array is @_";
if ( fork() == 0 ) {
# arm the alarm clock
alarm(10);
say "alarm set for ten in process $$ and pinging google";
# create a child process
my $trial = system("ping www.google.com");
say "trial is $trial";
exit(0);
}
print "Bounce wireless(y/n)?: ";
my $prompt1 = ;
chomp $prompt1;
if ( $prompt1 eq ( "y" | "Y" ) ) {
if ( fork() == 0 ) {
# arm the alarm clock
alarm(35);
say "alarm set for 35 in process $$ and restarting network";
# create a child process
my $trial2 = system("sudo service network-manager restart");
say "trial2 is $trial2";
sleep 30;
say "sleeping 30";
exit(0);
}
}
print "Do you think you're ready now(y/n)?: ";
my $prompt2 = ;
chomp $prompt2;
if ( $prompt2 eq ( "y" | "Y" ) ) {
my $return2 = createDir( $dirName, $sftp );
say "return2 is $return2";
}
else {
say "$error was too much this time: ceasing execution";
die;
}
return "execution shouldn't get here";
}
## ##
if ( fork() == 0 ) {
# arm the alarm clock
alarm(10);
say "alarm set for ten in process $$ and pinging google";
# create a child process
my $trial = system("ping www.google.com");
say "trial is $trial";
exit(0);
}
####
debug1: fd 0 clearing O_NONBLOCK
debug1: fd 1 clearing O_NONBLOCK