2 Commits

Author SHA1 Message Date
swg
aa7af00b78 Fixed not existing variable to . 2025-10-07 22:19:44 +01:00
swg
9e55f74777 README.md aktualisiert
Consistent name for user executing the backup.
2024-10-29 08:37:36 +00:00
2 changed files with 6 additions and 6 deletions

View File

@@ -33,7 +33,7 @@ The script throws out a log file of its activities. It is meant to be visible in
To give unrestricted access to everything via sudo is not a good idea. I'd choose to restrict elevated permissions to the specific commands needed.
In the sudoers file add the following lines.
I chose `cloudbackup`to be the user for doing the backup, you are free to chose anything else. In the sudoers file add the following lines.
```
# Cmnd alias specification
@@ -47,8 +47,8 @@ cloudbackup ALL=(www-data) NOPASSWD: OCC_NC, RSYNC
cloudbackup ALL=(www-data) NOPASSWD: MAINTENANCE_ON, MAINTENANCE_OFF
```
### cronjob
in crontab create an entry for the `cloud_backup.sh`. Replace `user` with yours doing the backup.
in crontab create an entry for the `cloud_backup.sh`. Replace `cloudbackup` with yours doing the backup.
```
# Nextcloud backup
12 1 * * 1 user /home/cloudbackup/cloud_backup.sh
12 1 * * 1 cloudbackup /home/cloudbackup/cloud_backup.sh
```

View File

@@ -180,9 +180,9 @@ for SOURCE in "${BACKUP_SOURCES[@]}"; do
if [ $? -ne 0 ]; then logger $LLERROR "Rsync of $SOURCE failed!"; fi
done
if [ "$S" ] && [ "$TOSSH" ] && [ -z "$FROMSSH" ]; then
logger $LLDEBUG "$S $TOSSH $LN -nsf $TARGET$TODAY $TARGET$LAST";
logger $LLINFO "Setting Link to last to »$TARGET$TODAY«";
$S $TOSSH "$LN -nsf $TARGET$TODAY $TARGET$LAST";
logger $LLDEBUG "$S $TOSSH $LN -nsf $BACKUP_TARGET$TODAY $BACKUP_TARGET$LAST";
logger $LLINFO "Setting Link to last to »$BACKUP_TARGET$TODAY«";
$S $TOSSH "$LN -nsf $BACKUP_TARGET$TODAY $BACKUP_TARGET$LAST";
if [ $? -ne 0 ]; then logger $LLERROR "Resetting link to last backup of todays failed!"; clean_up 1; fi
fi
logger $LLMDTRY "Backup of nextcloud done, cleaning up.";