/ Published in: Perl
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
#!/usr/bin/perl -w # @autor gpupo <[email protected]> # Use on project deployment with ssh keys prompt # Requeriment: (test on debian) libfile-slurp-perl libfile-read-perl libexpect-perl # You need to create a file called .myK containing the password of your key in your home directory. Not the example of safety, sorry:) use Expect; use File::Read; $path = $ENV{"HOME"} ."/.myK"; $file = read_file($path); $prompt = ".ssh/id_rsa':"; $exclude = $ENV{"HOME"} . '/wProjects/config/rsync_Cpanel_exclude.txt'; $cmd = 'rsync -r -t -v -L -z --progress --stats --exclude-from=' . $exclude . " @ARGV"; $exp = new Expect(); $exp->raw_pty(1); $exp->spawn($cmd); $exp->soft_close();