added custome cron scripts
This commit is contained in:
@@ -0,0 +1,11 @@
|
||||
#!/bin/bash
|
||||
LOG_FILE="/var/log/backup_docker.log"
|
||||
|
||||
exec >> "$LOG_FILE" 2>&1
|
||||
|
||||
echo "script started at: $(date)"
|
||||
|
||||
sudo rsync -aq --delete --chown juulk:juulk /home/juulk/docker/ /mnt/pandorica/docker
|
||||
|
||||
echo "script ended at: $(date)"
|
||||
echo "-------------------------------------------------------------------------------"
|
||||
@@ -0,0 +1,16 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Variables
|
||||
LOCATION="/home/juulk/docker/postgresql"
|
||||
RETENTION=7
|
||||
DATE=$(date +"%Y-%m-%d_%H-%M-%S")
|
||||
FILENAME="backup-$DATE.sql"
|
||||
|
||||
# Dump all databases
|
||||
docker exec -u postgres postgres pg_dumpall > "$LOCATION/$FILENAME"
|
||||
|
||||
# Zip dump
|
||||
gzip "$LOCATION/$FILENAME"
|
||||
|
||||
# Delete old backups
|
||||
find "$LOCATION" -name "backup-*.sql.gz" -type f -mtime +$RETENTION -exec rm {} \;
|
||||
@@ -0,0 +1,19 @@
|
||||
#!/bin/bash
|
||||
LOG_FILE="/var/log/update_reboot.log"
|
||||
REBOOT_FILE="/var/log/reboots.log"
|
||||
|
||||
exec >> "$LOG_FILE" 2>&1
|
||||
|
||||
echo "Script started at: $(date)"
|
||||
|
||||
sudo apt-get update && sudo apt-get upgrade -y
|
||||
|
||||
if [ -f /var/run/reboot-required ]; then
|
||||
echo "Rebooting at: $(date)"
|
||||
echo "-------------------------------------------------------------------------------"
|
||||
echo "Rebooted at: $(date)" >> "$REBOOT_FILE"
|
||||
sudo reboot now
|
||||
fi
|
||||
|
||||
echo "No reboot required, script ended at: $(date)"
|
||||
echo "-------------------------------------------------------------------------------"
|
||||
Reference in New Issue
Block a user