Community discussions

MikroTik App
 
jNiederauer
just joined
Topic Author
Posts: 2
Joined: Sat May 20, 2023 1:57 am

Backup - filename

Sat May 20, 2023 3:19 am

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?
 
User avatar
rextended
Forum Guru
Forum Guru
Posts: 11967
Joined: Tue Feb 25, 2014 12:49 pm
Location: Italy
Contact:

Re: Backup - filename

Tue May 23, 2023 10:47 am

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...
 
jNiederauer
just joined
Topic Author
Posts: 2
Joined: Sat May 20, 2023 1:57 am

Re: Backup - filename

Sun May 28, 2023 4:31 am

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.
 
User avatar
miconof
just joined
Posts: 4
Joined: Thu May 25, 2023 7:52 am
Location: France

Re: Backup - filename

Sun May 28, 2023 8:06 am

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
]

Who is online

Users browsing this forum: No registered users and 46 guests