Opened 12 years ago

Closed 10 months ago

#1020 closed enhancement (worksforme)

Auto-backup (hotcopy) with "overwrite" function

Reported by: Radoslaw Stachowiak Owned by: anybody
Priority: normal Component: Request-a-Hack
Severity: major Keywords: backup
Cc: Trac Release: 0.10



I just setup Trac for one project and realized that trac-admin allows to backup the trac project environment using hotcopy command.

However, when I did that it says: Command failed: [Errno 17] File exists:

This behaviour is discussed in the ticket Trac-3198 with the suggestion: """ 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 as a hack to the hotcopy command, so the command could be called:

trac-admin /trac hotcopy /trac-backup /tmp

Attachments (0)

Change History (6)

comment:1 Changed 12 years ago by Noah Kantrowitz

trac-admin is currently not extensbile by plugins. A more possible request would be to make a web UI to generate backups.

comment:2 Changed 12 years ago by Radoslaw Stachowiak

I believe this could be applied as patch.

comment:3 Changed 12 years ago by anonymous

I would 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 dirhotcopy <backup dir>

Extended functionality in case:

trac-admin <trac dirhotcopy <backup dir<tmpdir>

with these steps:

  1. check if that <backup dir already exists
  1. if yes, move the <backup dirfolder under <tmpdir(forcing overwrite )
  1. if that fails, stop here (previous backup attempt that got interrupted? anyway, manual clean-up needed)
  1. do the hotcopy in <backup>
  1. remove <backup dirfrom <tmpdir>.

I believe, that this is better approach as you do not need to have write permission into the parent dir of <trac diras it is in case of tracproject.old approach. Of cource I assume write permissions to the declared <tmpdir>.

comment:4 Changed 10 years ago by Kevin Calcagno

It's not a hack to TracAdmin itself as requested, but TracHotBackupScript may give you the functionality you're looking for. In your case, try running it with --num-backups=1. Each backup will have a different (time-stamped) name, but that small inconvenience is easily overlooked should you need to restore that backup someday.

comment:5 Changed 9 years ago by Ryan J Ollos

Summary: auto-backup (hotcopy) with "overwrite" functionAuto-backup (hotcopy) with "overwrite" function

comment:6 Changed 10 months ago by Ryan J Ollos

Resolution: worksforme
Status: newclosed

Modify Ticket

Change Properties
Set your email in Preferences
as closed The owner will remain anybody.
The resolution will be deleted.

Add Comment

E-mail address and name can be saved in the Preferences.

Note: See TracTickets for help on using tickets.