Skip to content

Commit

Permalink
better naming of backup files
Browse files Browse the repository at this point in the history
  • Loading branch information
mmguero committed Jan 10, 2023
1 parent faf1e40 commit 3903014
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions docs/netbox.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,13 @@ The NetBox database may be backed up and restored using `./scripts/netbox-backup

```
$ ./scripts/netbox-backup
NetBox configuration database saved to ('malcolm_netbox_backup_20230110-133855.psql.gz', 'malcolm_netbox_backup_20230110-133855.psql.media.tar.gz')
NetBox configuration database saved to ('malcolm_netbox_backup_20230110-133855.gz', 'malcolm_netbox_backup_20230110-133855.media.tar.gz')
```

To clear the existing NetBox database and restore a previous backup, run the following command (substituting the filename of the `netbox_….psql.gz` you wish to restore) from within the Malcolm installation directory while Malcolm is running:
To clear the existing NetBox database and restore a previous backup, run the following command (substituting the filename of the `netbox_….gz` you wish to restore) from within the Malcolm installation directory while Malcolm is running:

```
./scripts/netbox-restore --netbox-restore ./malcolm_netbox_backup_20230110-125756.psql.gz
./scripts/netbox-restore --netbox-restore ./malcolm_netbox_backup_20230110-125756.gz
```

Expand Down
2 changes: 1 addition & 1 deletion scripts/control.py
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,7 @@ def netboxBackup(backupFileName=None):
raise Exception(f'Error creating NetBox configuration database backup')

if (backupFileName is None) or (len(backupFileName) == 0):
backupFileName = f"malcolm_netbox_backup_{time.strftime('%Y%m%d-%H%M%S')}.psql.gz"
backupFileName = f"malcolm_netbox_backup_{time.strftime('%Y%m%d-%H%M%S')}.gz"

with gzip.GzipFile(backupFileName, "wb") as f:
f.write(bytes('\n'.join(results), 'utf-8'))
Expand Down

0 comments on commit 3903014

Please sign in to comment.