In the script that you could run as a cron job, you can create a folder name date and time and then back the logs to that folder. Subsequently, you could augment the script to tar and gzip the file and upload to an s3 bucket:-
$cat simplebackup.sh
_now=$(date +"%m_%d_%Y")
_dir="./backup_$_now"
mkdir $_dir
mv nohup_* $_dir
mv /opt/logs/* $_dir
rm -rf nohup_*
rm -rf /opt/logs/*
To see if the backup script executed you can look at "crontab -l" and then "/var/log/cron".
$cat simplebackup.sh
_now=$(date +"%m_%d_%Y")
_dir="./backup_$_now"
mkdir $_dir
mv nohup_* $_dir
mv /opt/logs/* $_dir
rm -rf nohup_*
rm -rf /opt/logs/*
To see if the backup script executed you can look at "crontab -l" and then "/var/log/cron".
No comments:
Post a Comment