...
In addition to version control it is often useful to backup folders. Especially since we tend to build self-contained applications.
First we use the tar command to ensure permissions are kept. Second we use relative paths to prevent accidents where you can easily untar and overwrite your work.
Last, we use a very specific naming structure, 2011-01-20.version.folder.user.comment.bck.extension and generally keep our backups in one single backup folder, /opt/backup/
For example, if we make a tar file to backup our /opt/tomcat-a/ folder,
Code Block | ||
---|---|---|
| ||
cd /opt tar -cvf ./backup/2011-01-20.v1.opt.tomcat-a.bhitch.before_upgrade.bck |
...
.tar |
Here are the details of how we use the naming structure,
- 2011-01-20 - the date, yyyy-mm-dd
...
- ensures the ls listing is sort-able
...
- version - references a version for the release
- folder - specifies what folder the backup should be restored to
- bck - the key we have chosen to make searching for backup easier
File Backup
File backup uses a similar convention. However with file backups we find it more useful to sort by the file name first then the date,
...