Create a Post
cancel
Showing results for 
Search instead for 
Did you mean: 
fwvpnitaly
Explorer

Trasfer logs via sftp older than 15 days

Greetings,
I'm trying to create a bash script that makes me a single .tar file of logs older than 15 days and sends them to me via sftp.
But I can't get the creation of the .tar file to work:

 

#!/bin/bash

find /var/log -type f -mtime +30 | xargs -0 tar -zcf file_compress.tar.gz;

export SSHPASS=XXXXXX
sshpass -e sftp -oBatchMode=no -b - XXXXXXX@XXXXXX << !
cd Incoming
put file_compress.tar.gz
bye
!

done

 

Any suggestion ?

0 Kudos
0 Replies

Leaderboard

Epsum factorial non deposit quid pro quo hic escorol.

Upcoming Events

    CheckMates Events