Page 1 of 1
Backup - filename
Posted: Sat May 20, 2023 3:19 am
by jNiederauer
Hey!
Might be a stupid question, but i need to configure the backups to be automatic but i need to change the filename. It need to show a fixed text along the date (ex: Backup_DATE.backup).
Is there a way to do it?
[PT]
Resumidamente, preciso fazer com que o backup seja automático e que o arquivo gerado tenha um nome fixo acompanhado da data (ex: Backup_DATA.backup).
É possível fazer essa configuração?
Re: Backup - filename
Posted: Tue May 23, 2023 10:47 am
by rextended
The forum is full of script for do backup, send it by mail, by ftp, etc.
Is useless start another topic over the other dozen already present.
Just use the search function, work also on google...
Re: Backup - filename
Posted: Sun May 28, 2023 4:31 am
by jNiederauer
I used and couldn't find what i wanted, that's why i created the topic.
If you don't have anything usefull do say, keep it to you, mate.. easy like that.
Re: Backup - filename
Posted: Sun May 28, 2023 8:06 am
by miconof
Here is my way to do my backup.
Pull backup over ssh ang git / snapshot it.
- Launch backup remotely
- Pull backup over ssh
- Push .rsc to git
- zfs snapshot receive vol
The date is not in the filename, but in the commit comment, and also in the zfs snapshot name.
#!/bin/sh
. /usr/local/bin/zfs-snapshot
USER_SSH=remote-user
IPs=X.X.X.X
IPa=Y.Y.Y.Y
ZFS=snob/backup/MikroTik
ssh $USER_SSH@$IPs '/export file=flash/Core-backup-swro'
ssh $USER_SSH@$IPs 'system backup save name=flash/Full-bin-swro'
ssh $USER_SSH@$IPa '/export file=Core-backup-acpo'
ssh $USER_SSH@$IPa 'system backup save name=Full-bin-acpo'
scp $USER_SSH@$IPs:/flash/Core-backup-swro.rsc /$ZFS/Router
scp $USER_SSH@$IPs:/flash/Full-bin-swro.backup /$ZFS/Router
scp $USER_SSH@$IPa:/Core-backup-acpo.rsc /$ZFS/AccessPoint
scp $USER_SSH@$IPa:/Full-bin-acpo.backup /$ZFS/AccessPoint
MESSAGE=$(date)
cd /$ZFS/mikrotik-config-git/
git pull
cp /$ZFS/Router/Core-backup-swro.rsc /$ZFS/mikrotik-config-git/
cp /$ZFS/AccessPoint/Core-backup-acpo.rsc /$ZFS/mikrotik-config-git/
git add /$ZFS/mikrotik-config-git/Core-backup-swro.rsc
git add /$ZFS/mikrotik-config-git/Core-backup-acpo.rsc
git commit -m "$(echo $MESSAGE)"
git push
do_snapshots $ZFS 12 hourly
do_snapshots $ZFS 7 daily
do_snapshots $ZFS 4 weekly
do_snapshots $ZFS 6 monthly
]