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

    Tue 23 Apr 2024 @ 11:00 AM (EDT)

    East US: What's New in R82

    Thu 25 Apr 2024 @ 11:00 AM (SGT)

    APAC: CPX 2024 Recap

    Tue 30 Apr 2024 @ 03:00 PM (CDT)

    EMEA: CPX 2024 Recap

    Thu 02 May 2024 @ 11:00 AM (SGT)

    APAC: What's new in R82

    Tue 23 Apr 2024 @ 11:00 AM (EDT)

    East US: What's New in R82

    Thu 25 Apr 2024 @ 11:00 AM (SGT)

    APAC: CPX 2024 Recap

    Tue 30 Apr 2024 @ 03:00 PM (CDT)

    EMEA: CPX 2024 Recap

    Thu 02 May 2024 @ 11:00 AM (SGT)

    APAC: What's new in R82
    CheckMates Events