Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- LOG_DIR="/home/{user}/metrics"
- BACKUP_DIR="/home/{user}/backups"
- mkdir -p "$BACKUP_DIR"
- DATE=$(date "+%Y%m%d%H")
- BACKUP_FILE="backup_metrics_${DATE}.tar.gz"
- tar -cf "${BACKUP_DIR}/${BACKUP_FILE}" "${LOG_DIR}/metrics_agg_"*.log
- gzip "${BACKUP_DIR}/${BACKUP_FILE}"
- rm -f "${LOG_DIR}/metrics_agg_"*.log
- ## chmod u+x ./backup_metrics.sh
- ## cronjob: 59 23 * * * bash /home/{user}/backup_metrics.sh
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement