The code posted in the wiki is for earlier versions of Core though.
PART=$(cat /opt/.backup_device)
versus
PART=$(cat /etc/sysconfig/backup_device)
Hey netnomad,
This seems to be unused?
USER=`cat /etc/sysconfig/tcuser`
HOME=`eval echo ~$USER`
Also, even though I never did it with the tce-dir because it's said to be bad practice on linux in general, but I think some paths and/or file names could contain spaces, thus respective variables should be quoted?
#!/bin/sh
# This saves a copy of backup or encrypted backup with the date and time.
PART="$(cat /etc/sysconfig/backup_device)"
MYDAT="$(cat /etc/sysconfig/mydata)"
DATE="$(date +"%Y.%m.%d-%H.%M.%S")"
DATABACK="$MYDAT-$DATE.tgz"
CRYPTBACK="$MYDAT-$DATE.tgz.bfe"
cd "/mnt/$PART"
[ -e "$MYDAT.tgz" ] && cp "$MYDAT.tgz" "$DATABACK"
[ -e "$MYDAT.tgz.bfe" ] && cp "$MYDAT.tgz.bfe" "$CRYPTBACK"
# This deletes the oldest if there are more than the number you select (the default is 5).
NUMBACK="$(ls "$MYDAT"-2* | wc -l)"
while [ "$NUMBACK" -gt 5 ] # Change 5 to the number of backups you want to keep.
do
ls -1t $MYDAT-2*tg* | tail -1 | xargs /bin/rm -f
NUMBACK="$(ls "$MYDAT"-2* | wc -l)"
done
Maybe too much but doesn't hurt, right? q: