Open source SRE cloud scripts collection


Opensource Collection of scripts 

# Tar and zip log files with todays date
tar cvf ~/logs.$(date +%F).$myrandom.tar /var/www/xxxx/*
gzip logs.$(date +%F).$myrandom.tar

# Add username and PW

# Open FTP connection to server
echo "open xx.xx.xx.xx"

# pass user login from above
echo "user $REM_USER $REM_PASS"

# If FTP server is requiring user input toggle the echo "prompt" below
# echo "prompt"

# make sure you are in the folder where you made the zip on the local server
echo "lcd ~/"

# Change to remote folder [optional]
#echo "cd remotefolder"

# if you want to put multiple files use mput, put will be fine for 1 file
echo "mput *.gz "

# Connect to the FTP with the above info
} | ftp -vin

# Remove the created zip file
rm logs.$(date +%F).$myrandom.tar.gz