#3198 closed enhancement (fixed)
Backup environment: hotcopy to work over existing hotcopy
Reported by: | Owned by: | Christian Boos | |
---|---|---|---|
Priority: | normal | Milestone: | 0.11 |
Component: | admin/console | Version: | 0.10-stable |
Severity: | normal | Keywords: | consider, backup |
Cc: | Branch: | ||
Release Notes: | |||
API Changes: | |||
Internal Changes: |
Description
# trac-admin /var/lib/trac hotcopy /var/lib/trac-backup Hotcopying /var/lib/trac to /var/lib/trac-backup ... Hotcopy done. # trac-admin /var/lib/trac hotcopy /var/lib/trac-backup Command failed: [Errno 17] File exists: '/var/lib/trac-backup' Hotcopying /var/lib/trac to /var/lib/trac-backup ...
It should just update the existing hotcopy properly.
Additionally it should be possible to make hotcopy silent, if there is no error. Getting such messages from cron is annoying.
Attachments (0)
Change History (18)
comment:1 by , 19 years ago
Resolution: | → wontfix |
---|---|
Status: | new → closed |
comment:3 by , 19 years ago
You would prefer that when the user starts a hotcopy, the previous hotcopy is destroyed ?
It's not about making software hard to use, it's about preventing from losing data if case of a user mistake or a software failure.
It's easy to wrap the hotcopy in a script that move the previous hotcopy out of the way before it starts a new backup. It is not to recover from overwritten data ;-)
comment:4 by , 18 years ago
Could the trac-admin not do this simple task for the user? Isn't software meant to do these tasks for us? As developers we should be thinking hard so our users don't have to.
comment:5 by , 18 years ago
Resolution: | wontfix |
---|---|
Status: | closed → reopened |
Version: | 0.9.5 → 0.10.3 |
""" You're better off moving the previous hotcopy to a temp location, make a new hotcopy, then remove the temp location once the hotcopy has completed successfully. """
I propose to add this suggested functionality to the hotcopy command, so the command could be called:
trac-admin /trac hotcopy /trac-backup /tmp
PS: Backupninja is not for Windows.
comment:6 by , 18 years ago
Milestone: | → 0.10.4 |
---|
What about simply doing this:
- check if that <backup> folder already exists
- if yes, move the <backup> folder to <backup>.old
- if that fails, stop here (previous backup attempt that got interrupted? anyway, manual clean-up needed)
- do the hotcopy in <backup>
- remove <backup>.old. Although I'm always a bit uncomfortable when we add another usage of rmtree ;)
comment:7 by , 18 years ago
I would rather keep the original hotcopy functionality and add extended one as well. The steps could be:
Current functionality remains in case we call (ie. it gives error in case of existing backup dir):
trac-admin <trac dir> hotcopy <backup dir>
Extended functionality in case:
trac-admin <trac dir> hotcopy <backup dir> <tmpdir>
with these steps:
- check if that <backup dir> already exists
- if yes, move the <backup dir> folder under <tmpdir> (forcing overwrite )
- if that fails, stop here (previous backup attempt that got interrupted? anyway, manual clean-up needed)
- do the hotcopy in <backup>
- remove <backup dir> from <tmpdir>.
I believe, that this is better approach as you do not need to have write permission into the parent dir of <trac dir> as it is in case of tracproject.old approach. Of cource I assume write permissions to the declared <tmpdir>.
comment:8 by , 18 years ago
I'm really -1 on this feature: let Trac does what it is meant for, and use your own scripts to customize your back up sequence the way you want.
Moving an existing back up copy is not a Trac task. It's an admin task.
Keep it simple. Unix tools are powerful because they are designed to do a precise task, and to do it well. They are a lot of free tools available that can manage archive rotation. There's no need to push this kind of task in Trac.
follow-up: 10 comment:9 by , 18 years ago
Eblot, I understand your opinion. I also believe this should not do the task of other tools.
The requested approach is plotted only to allow overwrite. It should not expand to backup rotation etc.
Overwrite is important for some back up tools for incremental backup.
(And I am sorry in point 2 it should say copy instead of move).
comment:10 by , 18 years ago
Replying to radek:
The requested approach is plotted only to allow overwrite. It should not expand to backup rotation etc.
Moving/renaming file is a kind of basic rotation.
Why not doing this from the calling script?
trac-admin hotcopy tmpdir && mv tmpdir backupdir
the same action could be achieved from an awful batch script w/ Windows: hotcopy in a temp dir; if the back up has been successfully created, rename the temp directory as the previous directory.
I'm not sure to understand the need to re-implement this feature in trac-admin (?)
comment:11 by , 18 years ago
Keywords: | consider added |
---|---|
Milestone: | 0.10.5 → 1.0 |
comment:12 by , 17 years ago
Keywords: | backup added |
---|---|
Summary: | hotcopy to work over existing hotcopy → Backuping environment: hotcopy to work over existing hotcopy |
Version: | 0.10.3 → 0.10-stable |
Windows users, you can schedule such shell command:
c:\python25\scripts\trac-admin E:\somepath\Trac_env hotcopy s:\Trac_env_Backups\%date%
comment:13 by , 17 years ago
Milestone: | 1.0 → 0.11 |
---|---|
Owner: | changed from | to
Status: | reopened → new |
I side with eblot here, as doing a backup really depends on some outside strategy, and being able to overwrite an existing backup by default can't really be considered as safe…
However, the current behavior is not really satisfying, as we're failing with an internal error.
comment:14 by , 17 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
I fixed the hotcopy in r6486, so that a nicer error message is produce and we make sure that an error exit code is still given back to the shell, so that an alternative action can still be taken by a backup script.
comment:15 by , 15 years ago
Currently implementing a backup for trac on astf 1 to 3. It will perform a trac-admin hotcopy
, then scp it to a directory on astf-1 to be picked up by simple-backup.sh
comment:16 by , 13 years ago
Would be nice if trac-admin allowed a hotcopy into an existing, empty directory. (rsnapshot calls backup scripts with the working directory set to a new empty directory to place the backup in. Now with trac-admin, I need to create an extra subdirectory.) This would be more in line with svnadmin hotcopy as well.
comment:17 by , 7 years ago
I would also like to be able to hotcopy into an empty directory. I run trac in docker, and I want to write the backup into a mounted volume. Now I need to create new folder in the mounted volume.
comment:18 by , 7 years ago
Summary: | Backuping environment: hotcopy to work over existing hotcopy → Backup environment: hotcopy to work over existing hotcopy |
---|
This cannot be done in an atomic operation, so if something fails in the middle of the hotcopy it will leave you with a broken hotcopy and no previous good version. You're better off moving the previous hotcopy to a temp location, make a new hotcopy, then remove the temp location once the hotcopy has completed successfully.
Backupninja includes scripts for doing this easily for your Trac and SVN backups.