<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://rt-wiki.bestpractical.com/index.php?action=history&amp;feed=atom&amp;title=BackupRT</id>
	<title>BackupRT - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://rt-wiki.bestpractical.com/index.php?action=history&amp;feed=atom&amp;title=BackupRT"/>
	<link rel="alternate" type="text/html" href="https://rt-wiki.bestpractical.com/index.php?title=BackupRT&amp;action=history"/>
	<updated>2026-08-24T07:20:16Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.41.1</generator>
	<entry>
		<id>https://rt-wiki.bestpractical.com/index.php?title=BackupRT&amp;diff=322&amp;oldid=prev</id>
		<title>Admin: 2 revisions imported</title>
		<link rel="alternate" type="text/html" href="https://rt-wiki.bestpractical.com/index.php?title=BackupRT&amp;diff=322&amp;oldid=prev"/>
		<updated>2016-04-06T20:03:19Z</updated>

		<summary type="html">&lt;p&gt;2 revisions imported&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;&amp;#039;&amp;#039;&amp;#039;Introduction&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
The following script was written to provide a quick way to run a backup of the Request Tracker application installation. This is a good tool to use if you&amp;#039;re hacking at templates and objects to ensure that you have a known good restore point.&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Requirements&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;nowiki&amp;gt; I wrote this for Debain Sarge/Stable and it depends on having the exim4 mailer installed. I also requires that there is a &amp;#039;&amp;#039;tmp&amp;#039;&amp;#039; dir in &amp;#039;&amp;#039;/root&amp;#039;&amp;#039;. You can of course change this to whatever directory that you wish. I&amp;#039;ll be refining this script as time permits. &amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Caveat Emptor&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
This script is provided with no warranties expressed or implied. Use your own risk. Milage may vary.&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;TODO&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
* Add section to detect mailer and automatically set this envvar&lt;br /&gt;
* Add automatic tmpfile cleanup&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;#!/bin/bash&lt;br /&gt;
 #&lt;br /&gt;
 # backupRT.sh&lt;br /&gt;
 #&lt;br /&gt;
 # $Author: www-data $&lt;br /&gt;
 # $Revision: 1.5 $&lt;br /&gt;
 # $Id: backupRT,v 1.5 2006/04/10 15:55:01 www-data Exp $&lt;br /&gt;
 #&lt;br /&gt;
 # Runs a file level backup of the contents of the following&lt;br /&gt;
 # directories:&lt;br /&gt;
 #&lt;br /&gt;
 # /usr/local/share/request-tracker3.4&lt;br /&gt;
 # /usr/share/request-tracker3.4&lt;br /&gt;
 #&lt;br /&gt;
 # Into a file named rtappbak-{date}.tar.gz&lt;br /&gt;
 #&lt;br /&gt;
 &lt;br /&gt;
 #&lt;br /&gt;
 # Implementation Specific Variables&lt;br /&gt;
 #&lt;br /&gt;
 # You can change this to another directory for the tmp files.&lt;br /&gt;
 # I don&amp;#039;t like to dump in /tmp&lt;br /&gt;
 &lt;br /&gt;
 SCRTMPDIR=/root/tmp/&lt;br /&gt;
 MAILHEADER=$SCRTMPDIRrtbakfiles-mail&lt;br /&gt;
 rtbakWATCHER=###YOUREMAILADDRESSHERE###&lt;br /&gt;
 MAILSERVER=###YOUREMAILSERVERHOSTNAME###&lt;br /&gt;
 &lt;br /&gt;
 #&lt;br /&gt;
 # Script Variables&lt;br /&gt;
 #&lt;br /&gt;
 curday=`date +&amp;quot;%Y%m%d%H%M%S&amp;quot;`&lt;br /&gt;
 prefn=&amp;quot;rtappbak-&amp;quot;&lt;br /&gt;
 backdir=/var/backups/rt/&lt;br /&gt;
 fullfn=$backdir$prefn$curday.tgz&lt;br /&gt;
 rtbakCHANGES_FILE=/root/tmp/rtbakfiles&lt;br /&gt;
 HOSTNAME=`/bin/hostname`&lt;br /&gt;
 FQDN=`/bin/hostname -f`&lt;br /&gt;
 fullFILENAME=`pwd`$fullfn&lt;br /&gt;
 &lt;br /&gt;
 #&lt;br /&gt;
 # Make/Verify target dirs&lt;br /&gt;
 #&lt;br /&gt;
 if [ ! -d $backdir ]; then&lt;br /&gt;
   mkdir $backdir;&lt;br /&gt;
 fi&lt;br /&gt;
 &lt;br /&gt;
 if [ ! -d $SCRTMPDIR ]; then&lt;br /&gt;
   mkdir $SCRTMPDIR;&lt;br /&gt;
 fi&lt;br /&gt;
 &lt;br /&gt;
 # do the backup&lt;br /&gt;
 tar cvzf $fullfn /usr/local/share/request-tracker3.4 /usr/share/request-tracker3.4 /etc/request-tracker3.4&lt;br /&gt;
 &lt;br /&gt;
 #get the file list and send to $rtbakCHANGES_FILE&lt;br /&gt;
 tar tvzf $fullfn &amp;amp;gt; $rtbakCHANGES_FILE&lt;br /&gt;
 &lt;br /&gt;
 #create message file and send to watcher&lt;br /&gt;
 if [ -s $CHANGES_FILE ] ; then&lt;br /&gt;
   echo HELO $MAILSERVER &amp;amp;gt; $MAILHEADER&lt;br /&gt;
   echo MAIL FROM:root@$FQDN  &amp;amp;gt;&amp;amp;gt; $MAILHEADER&lt;br /&gt;
   echo RCPT TO:$rtbakWATCHER &amp;amp;gt;&amp;amp;gt; $MAILHEADER&lt;br /&gt;
   echo DATA &amp;amp;gt;&amp;amp;gt; $MAILHEADER&lt;br /&gt;
   echo Subject: $HOSTNAME RT Application Backup &amp;amp;gt;&amp;amp;gt; $MAILHEADER&lt;br /&gt;
   echo Backup of files from the RT install on ${HOSTNAME}: &amp;amp;gt;&amp;amp;gt; $MAILHEADER&lt;br /&gt;
   echo This file is located at: &amp;amp;gt;&amp;amp;gt; $MAILHEADER&lt;br /&gt;
   echo ${HOSTNAME}:$fullFILENAME &amp;amp;gt;&amp;amp;gt; $MAILHEADER&lt;br /&gt;
   echo &amp;amp;gt;&amp;amp;gt; $MAILHEADER&lt;br /&gt;
   cat $rtbakCHANGES_FILE &amp;amp;gt;&amp;amp;gt; $MAILHEADER&lt;br /&gt;
   echo . &amp;amp;gt;&amp;amp;gt; $MAILHEADER&lt;br /&gt;
   echo QUIT &amp;amp;gt;&amp;amp;gt; $MAILHEADER&lt;br /&gt;
   exim4 -bs &amp;amp;lt; $MAILHEADER&lt;br /&gt;
 fi&lt;br /&gt;
 &lt;br /&gt;
 &amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Rev 40 Notes: Cleaned up variable declarations and added target directory checking/creation.&lt;br /&gt;
&lt;br /&gt;
[[MichaelErana]] &amp;lt;u&amp;gt;g33k (at) efamilynj.org&amp;lt;/u&amp;gt;&lt;/div&gt;</summary>
		<author><name>Admin</name></author>
	</entry>
</feed>