<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.xmission.com/index.php?action=history&amp;feed=atom&amp;title=Rsync_Backup_Script</id>
	<title>Rsync Backup Script - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.xmission.com/index.php?action=history&amp;feed=atom&amp;title=Rsync_Backup_Script"/>
	<link rel="alternate" type="text/html" href="https://wiki.xmission.com/index.php?title=Rsync_Backup_Script&amp;action=history"/>
	<updated>2026-05-19T11:34:36Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.43.1</generator>
	<entry>
		<id>https://wiki.xmission.com/index.php?title=Rsync_Backup_Script&amp;diff=6075&amp;oldid=prev</id>
		<title>Jab at 04:46, 28 January 2014</title>
		<link rel="alternate" type="text/html" href="https://wiki.xmission.com/index.php?title=Rsync_Backup_Script&amp;diff=6075&amp;oldid=prev"/>
		<updated>2014-01-28T04:46:23Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 22:46, 27 January 2014&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l58&quot;&gt;Line 58:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 58:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;done&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;done&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;/pre&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;/pre&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;[[Category:Troubleshooting]]&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Jab</name></author>
	</entry>
	<entry>
		<id>https://wiki.xmission.com/index.php?title=Rsync_Backup_Script&amp;diff=2592&amp;oldid=prev</id>
		<title>Pashdown: fix script</title>
		<link rel="alternate" type="text/html" href="https://wiki.xmission.com/index.php?title=Rsync_Backup_Script&amp;diff=2592&amp;oldid=prev"/>
		<updated>2009-05-01T15:02:11Z</updated>

		<summary type="html">&lt;p&gt;fix script&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 09:02, 1 May 2009&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l13&quot;&gt;Line 13:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 13:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;DATE=`date +%Y%m%d-%H%M%S`&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;DATE=`date +%Y%m%d-%H%M%S`&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;ssh $SERVER &quot;if [ ! -f $SERVERDIR/log; then mkdir $SERVERDIR/log; \&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;ssh $SERVER &quot;if [ ! -f $SERVERDIR/log &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;]&lt;/ins&gt;; then mkdir $SERVERDIR/log; \&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;   fi;&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;   fi;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;   if [ ! -f $SERVERDIR/$HOST/daily.0; then mkdir $SERVERDIR/$HOST/daily.0; \&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;   if [ ! -f $SERVERDIR/$HOST/daily.0 &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;]&lt;/ins&gt;; then mkdir $SERVERDIR/$HOST/daily.0; \&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;   fi&amp;quot;&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;   fi&amp;quot;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Pashdown</name></author>
	</entry>
	<entry>
		<id>https://wiki.xmission.com/index.php?title=Rsync_Backup_Script&amp;diff=2591&amp;oldid=prev</id>
		<title>Pashdown: rsync script v1.0</title>
		<link rel="alternate" type="text/html" href="https://wiki.xmission.com/index.php?title=Rsync_Backup_Script&amp;diff=2591&amp;oldid=prev"/>
		<updated>2009-04-30T20:39:40Z</updated>

		<summary type="html">&lt;p&gt;rsync script v1.0&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;==Introduction==&lt;br /&gt;
This is a sample backup script, utilizing rsync, which will backup a Linux or Mac OS X system to XMission&amp;#039;s [[Remote Drive]] service.  It can be adapted easily for other servers.&lt;br /&gt;
&lt;br /&gt;
After the initial copy, it only backs up incremental changes, saving you time and storage.&lt;br /&gt;
==Script==&lt;br /&gt;
&amp;lt;pre&amp;gt;#!/bin/bash&lt;br /&gt;
HOST=`hostname -s`&lt;br /&gt;
EXCLUDE=&amp;#039;--exclude=**/[Cc]ache/**&amp;#039;&lt;br /&gt;
RSYNC_ARGS=&amp;quot;-vaz --progress --delete --delete-excluded --delete-after $EXCLUDE&amp;quot;&lt;br /&gt;
BACKUP_DIRS=&amp;quot;/var/www /home /etc /usr/local /var/spool/cron /var/lib&amp;quot;&lt;br /&gt;
SERVER=&amp;quot;shell.xmission.com&amp;quot;&lt;br /&gt;
SERVERDIR=&amp;quot;backup&amp;quot;&lt;br /&gt;
DATE=`date +%Y%m%d-%H%M%S`&lt;br /&gt;
&lt;br /&gt;
ssh $SERVER &amp;quot;if [ ! -f $SERVERDIR/log; then mkdir $SERVERDIR/log; \&lt;br /&gt;
  fi;&lt;br /&gt;
  if [ ! -f $SERVERDIR/$HOST/daily.0; then mkdir $SERVERDIR/$HOST/daily.0; \&lt;br /&gt;
  fi&amp;quot;&lt;br /&gt;
&lt;br /&gt;
ssh $SERVER &amp;quot;rm -rf $SERVERDIR/$HOST/daily.8; \&lt;br /&gt;
  mv $SERVERDIR/$HOST/daily.7 $SERVERDIR/$HOST/daily.8; \&lt;br /&gt;
  mv $SERVERDIR/$HOST/daily.6 $SERVERDIR/$HOST/daily.7; \&lt;br /&gt;
  mv $SERVERDIR/$HOST/daily.5 $SERVERDIR/$HOST/daily.6; \&lt;br /&gt;
  mv $SERVERDIR/$HOST/daily.4 $SERVERDIR/$HOST/daily.5; \&lt;br /&gt;
  mv $SERVERDIR/$HOST/daily.3 $SERVERDIR/$HOST/daily.4; \&lt;br /&gt;
  mv $SERVERDIR/$HOST/daily.2 $SERVERDIR/$HOST/daily.3; \&lt;br /&gt;
  mv $SERVERDIR/$HOST/daily.1 $SERVERDIR/$HOST/daily.2; \&lt;br /&gt;
  cp -al $SERVERDIR/$HOST/daily.0 $SERVERDIR/$HOST/daily.1&amp;quot;&lt;br /&gt;
&lt;br /&gt;
for DIR in $BACKUP_DIRS; do&lt;br /&gt;
   rsync $RSYNC_ARGS $DIR ${SERVER}:$SERVERDIR/$HOST/daily.0/ &amp;gt;&amp;gt;/tmp/$HOST-$DATE&lt;br /&gt;
done&lt;br /&gt;
&lt;br /&gt;
gzip --best /tmp/$HOST-$DATE&lt;br /&gt;
&lt;br /&gt;
scp /tmp/$HOST-$DATE.gz $SERVER:$SERVERDIR/log&lt;br /&gt;
&lt;br /&gt;
rm /tmp/$HOST-$DATE.gz&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==Cron Entry==&lt;br /&gt;
You will need a cron entry to rotate out the old weekly directories and prune the log files, depending on how long you want to keep them.  The below example keeps a month&amp;#039;s worth of weekly incremental backups.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
15 3 * * Sun backup-weekly &amp;gt;/dev/null 2&amp;gt;&amp;amp;1&lt;br /&gt;
0 5 * * * find backup/log -type f -mtime +14 -exec rm -rf {} \;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
backup-weekly script:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/bin/sh&lt;br /&gt;
&lt;br /&gt;
cd backup&lt;br /&gt;
for DIR in `ls -1d */daily.8 | awk -F / &amp;#039;{print $1}&amp;#039;`; do&lt;br /&gt;
  cd $DIR&lt;br /&gt;
  rm -rf weekly.[3456789]&lt;br /&gt;
  mv weekly.2 weekly.3&lt;br /&gt;
  mv weekly.1 weekly.2&lt;br /&gt;
  mv daily.8 weekly.0&lt;br /&gt;
  cd ..&lt;br /&gt;
done&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>Pashdown</name></author>
	</entry>
</feed>