in reply to Backup Script Pb

If you set non-blocking mode, the print calls may fail.

Also, if you close the channel before the remote programs end and any of them tries to write data to its stdout or stderr streams it may get an error or a SIGHUP and abort.

Replies are listed 'Best First'.
Re^2: Backup Script Pb
by WTem (Novice) on Apr 30, 2016 at 03:22 UTC

    Oh yeah !!

    I deleted "$chan->blocking(0);"

    I added "sleep (15);" after the 2 tar commands line

    There is now only 2 octets difference between file test and test2. I tried the backup file created with the script and it works.

    Thanks for the help !! Once you have the answer it sounds so dump xD

      Instead of sleeping for a fixed amount of time, you can use the wait_eof method.

        Can you please enlight me with this method ? I read about the eof command in perldoc site.

        I may not use it correctly but what I did is to close the ssh connexion like this:

        $chan->close() if eof;

        It works too ...