32 lines
1.1 KiB
Bash
32 lines
1.1 KiB
Bash
#!/bin/bash
|
|
|
|
PATH=$PATH:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin
|
|
|
|
GOTIFY_TOKEN="token"
|
|
GOTIFY_MESSAGE="Backup task init: **"`date +"%d/%m/%Y %H:%M:%S"`"** \r"
|
|
LOG_FILE="hostname_"`date +"%d-%m-%Y"`".txt"
|
|
PATH_LOCAL_BACKUPS="/path/to/temporal/backups/"
|
|
PATH_ORIGIN_DATA="/path/to/nextcloud/data/"
|
|
REMOTE_SERVER="remote.example.com"
|
|
REMOTE_PATH="/path/to/remote/store/backups/"
|
|
|
|
mkdir -p $PATH_LOCAL_BACKUPS
|
|
touch $LOG_FILE
|
|
|
|
sh ~/backup_db.sh "$LOG_FILE" "$PATH_LOCAL_BACKUPS" "$REMOTE_SERVER" "$REMOTE_PATH"
|
|
sh ~/backup_dir.sh "$LOG_FILE" "$PATH_LOCAL_BACKUPS" "$REMOTE_SERVER" "$REMOTE_PATH"
|
|
sh ~/backup_total.sh "$LOG_FILE" "$PATH_ORIGIN_DATA" "$REMOTE_SERVER" "$REMOTE_PATH"
|
|
sh ~/backup_clean.sh "$LOG_FILE" "$REMOTE_SERVER" "$REMOTE_PATH"
|
|
|
|
# send log to logs public archive
|
|
LOG_URL=$(sh ~/logger.sh "$LOG_FILE")
|
|
|
|
# delete local log
|
|
rm $LOG_FILE
|
|
|
|
GOTIFY_MESSAGE="${GOTIFY_MESSAGE} Backup task end: **"`date +"%d/%m/%Y %H:%M:%S"`"** \r"
|
|
GOTIFY_MESSAGE="${GOTIFY_MESSAGE} [LogFile]($LOG_URL)"
|
|
|
|
# send gotify notification
|
|
sh ~/gotifypush.sh "NC Total Backup" "$GOTIFY_MESSAGE" 5 "$GOTIFY_TOKEN" "$LOG_URL"
|