Modify

Opened 8 years ago

Last modified 5 years ago

#1020 new enhancement

Auto-backup (hotcopy) with "overwrite" function

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

Description

Hi,

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 (5)

comment:1 Changed 8 years ago by coderanger

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 8 years ago by radek

I believe this could be applied as patch.

comment:3 Changed 8 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 6 years ago by kcalcagno

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 5 years ago by rjollos

  • Summary changed from auto-backup (hotcopy) with "overwrite" function to Auto-backup (hotcopy) with "overwrite" function

Add Comment

Modify Ticket

Action
as new .
Author


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

 
Note: See TracTickets for help on using tickets.