0

All the scripts I've seems to be pushing code from server to a backup server, I am trying to set the backup server to pull code from a live server.

I've managed it with the sql:

ssh -C [email protected] mysqldump -u user --password=test example | gzip > Backups/SQL_Backups/example/example_`date +%d%b%Y`.sql.gz

And that works perfectly, but now I'm trying to tar a public folder and send it back, so far I've managed to ssh on and tar the correct folder, but how do I send it back?

ssh -C [email protected] tar -c --bzip2 -f backup.tar /home/user/example.com/public/

I've tried doing this but it creates a blank archive

ssh -C [email protected] tar -c --bzip2 -f backup.tar /home/user/example.com/public/ | Backups/File_Backups/example/example_public_`date +%d%b%Y`.tar

1 Answer 1

1

I think you should try with:

 ssh [email protected] tar -c --bzip2 -f - /home/user/example.com/public/ > Backups/File_Backups/example/example_public_`date +%d%b%Y`.tar.bz2
2
  • That works great! I did try the > method but I didnt know you could put - as the file name as I was getting a blank archive, thanks!
    – Adam
    Commented Mar 11, 2015 at 12:56
  • 1
    Please also note that I removed -C in ssh, you do not want gzip compression for data compressed with bzip2. Commented Mar 11, 2015 at 13:01

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .