<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>The Adventures of Systems Boy! &#187; Scripts</title>
	<atom:link href="http://systemsboy.com/category/scripts/feed" rel="self" type="application/rss+xml" />
	<link>http://systemsboy.com</link>
	<description>Big, Honkin' Systems Stuff</description>
	<lastBuildDate>Fri, 30 Dec 2011 23:09:50 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Scripts Part 8: Toggle Hidden Files</title>
		<link>http://systemsboy.com/2009/04/scripts-part-8-toggle-hidden-files.html</link>
		<comments>http://systemsboy.com/2009/04/scripts-part-8-toggle-hidden-files.html#comments</comments>
		<pubDate>Mon, 27 Apr 2009 17:19:41 +0000</pubDate>
		<dc:creator>systemsboy</dc:creator>
				<category><![CDATA[Scripts]]></category>
		<category><![CDATA[ScriptSharing]]></category>
		<category><![CDATA[TheBlog]]></category>

		<guid isPermaLink="false">http://systemsboy.com/?p=1468</guid>
		<description><![CDATA[Yes, you read that right. It&#8217;s time for another entry in the Script Sharing category. It&#8217;s been a damn long time since I&#8217;ve posted anything here, but I&#8217;ve actually been doing a lot of scripting, and I just realized that I had some potentially useful stuff lying around. So hopefully I&#8217;ll be able to post [...]]]></description>
			<content:encoded><![CDATA[<p>Yes, you read that right. It&#8217;s time for another entry in the <a href="http://systemsboy.com/category/scriptsharing" target="_blank">Script Sharing</a> category. It&#8217;s been a damn long time since I&#8217;ve posted anything here, but I&#8217;ve actually been doing a lot of scripting, and I just realized that I had some potentially useful stuff lying around. So hopefully I&#8217;ll be able to post some new stuff to this section once and a while.</p>
<p>Also, in reviving the Script Sharing series, I realized that all the old scripts were missing. Seems when I <a href="http://systemsboy.com/2009/03/the-saga-of-the-new-web-hosting-provider.html">switched ISPs</a> a while back, I forgot to move over the archive. Well, never fear, they&#8217;re all back now.</p>
<p>Today&#8217;s script is actually an Automator workflow for the Finder. (What sort of <a href="http://systemsboy.com/2009/03/workflow-design.html">workflow designer</a> would I be if I didn&#8217;t create the odd Automator workflow every now and again?) This workflow will turn hidden files on and off in the Finder. To enable it, simply unzip the below-linked download and place the resultant file in your Workflows folder (~/Library/Workflows/Applications/Finder).</p>
<div id="attachment_1475" class="wp-caption aligncenter" style="width: 540px"><a href="http://systemsboy.com/wp-content/uploads/2009/04/toggle-hidden-workflow.png" target="_blank"><img class="size-full wp-image-1475" title="toggle-hidden-workflow" src="http://systemsboy.com/wp-content/uploads/2009/04/toggle-hidden-workflow.png" alt="toggle-hidden-workflow" width="530" height="226" /></a><p class="wp-caption-text">Toggle Hidden Files</p></div>
<p>To access it, right-click (or control-click) anywhere in the Finder and navigate to More-&gt;Automator in the contextual menu. Select &#8220;Toggle-HiddenFiles&#8221; and your Finder will restart. When it comes back up, you&#8217;ll notice that hidden files are no longer hidden. To reverse the effect, simply repeat the process. Rerunning the script will re-hide invisible files.</p>
<p>So, here&#8217;s the script:</p>
<p><a href="http://systemsboy.com/wp-content/uploads/2009/04/toggle-hiddenfilesworkflow.zip">Toggle Hidden Files Workflow</a></p>
<p>Enjoy!</p>
]]></content:encoded>
			<wfw:commentRss>http://systemsboy.com/2009/04/scripts-part-8-toggle-hidden-files.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Scripts Part 7: Contextual Menus with Automator</title>
		<link>http://systemsboy.com/2007/03/scripts-part-7-contextual-menus-with-automator.html</link>
		<comments>http://systemsboy.com/2007/03/scripts-part-7-contextual-menus-with-automator.html#comments</comments>
		<pubDate>Sat, 31 Mar 2007 19:00:00 +0000</pubDate>
		<dc:creator>systemsboy</dc:creator>
				<category><![CDATA[Applications]]></category>
		<category><![CDATA[MacOSX]]></category>
		<category><![CDATA[NIX]]></category>
		<category><![CDATA[Scripts]]></category>
		<category><![CDATA[ScriptSharing]]></category>

		<guid isPermaLink="false">http://systemsboy.com/2007/03/scripts-part-7-contextual-menus-with-automator/</guid>
		<description><![CDATA[Recently, for some odd reason, there has been a spate of solutions to the problem of creating new files in the Finder via a contextual menu. One involves a contextual menu plugin called NuFile. Another involves installing Big Cats Scripts and linking it to an Applescript. But honestly — and I&#8217;m surprised someone else didn&#8217;t [...]]]></description>
			<content:encoded><![CDATA[<p>Recently, for some odd reason, there has been a <a href="http://www.tuaw.com/2007/03/28/last-post-ever-about-creating-new-files-from-finder/">spate</a> of <a href="http://www.tuaw.com/2007/03/26/quicksilver-tip-for-switchers-make-new-file/">solutions</a> to the problem of creating <a href="http://www.coldpizzasoftware.com/documentpalette/">new files in the Finder</a> via a contextual menu. One involves a contextual menu plugin called <a href="http://growlichat.com/NuFile.php">NuFile</a>. Another involves installing <a href="http://ranchero.com/bigcat/">Big Cats Scripts</a> and linking it to an <a href="http://daringfireball.net/2007/03/new_text_files_contextual_menu">Applescript</a>. But honestly — and I&#8217;m surprised someone else didn&#8217;t think of this first — when faced with simple contextual menu tasks, these days my first thought is to look to <a href="http://www.apple.com/macosx/features/automator/">Automator</a>.</p>
<p>And by golly, that&#8217;s just what I did. Here are a few Automator workflows that do, more or less what the afore-linked methods do. To me, the advantage of the Automator approach is that you don&#8217;t need to install anything. It&#8217;s all baked in. Which means you don&#8217;t ever need to update anything either. Nice. Simple. And, yeah, kind of the whole point of Automator.</p>
<p>So here you go. Maybe someone will find this useful, if for nothing other than as an exercise in creating contextual menu functionality with Automator. Or skinning a cat multiple ways. Or something. To use this, download the .zip file, unzip it and place it in:<br />
<span style="font-size:100%;"><span style="font-family:courier new;">~/Library/Workflows/Applications/Finder</span></span></p>
<p><a href="http://systemsboy.com/archive/NewTextFile.zip">NewTextFile Workflow</a></p>
<p>It should become active immediately.</p>
<p>Also, here are a couple variants. One will create a text file, and then open it in TextWrangler (if you have TextWrangler, and if you don&#8217;t, go <a href="http://www.barebones.com/products/textwrangler/">get it now</a>); the other creates a Word document, and opens it in Word. I&#8217;m far to lazy to completely duplicate the functionality of NuFile. But if you examine these workflows, you can at least see now how that would be possible (in fact, fairly easy) to accomplish.</p>
<p><a href="http://systemsboy.com/archive/NewTextFile-Variants.zip">NewTextFile Workflow Variants</a></p>
<p>I actually think it would be great if Apple made it drop dead simple to create true contextual menus for the Finder. Fortunately, Automator gets us pretty close.</p>
<p>Oh, yeah, and since this is technically script writing, and since I haven&#8217;t posted to that series in some time, we&#8217;re gonna go ahead and call this a <a href="http://systemsboy.com/category/ScriptSharing">Script Sharing</a> post. Deal with it.</p>
<p>Right. Good night.</p>
<p><span style="font-weight: bold;">UPDATE<span style="font-size:78%;"></span>: </span><span style="font-size:78%;"><span style="font-style: italic;">Revised March 31, 2007, 3:00 PM</span></span><br />
<a href="http://yellow-camp.com/blog/">Stephan Cleaves</a> has added yet another <a href="http://yellow-camp.com/2007/03/30/new-file-in-a-finder-window/">implementation</a> of this idea. He&#8217;s using a combination of Automator and AppleScript. I certainly think his implementation is better than mine in a few ways. Certainly more full-featured. It will prompt for a file name, for instance, and takes pains not to overwrite a preexisting file with the same name. Nice. But we&#8217;re taking very different approaches to the same idea (his version places a file in the front-most Finder window, my version places it in the right-clicked folder), and he was confused by my approach. After speaking to him via comments on his blog, I realized that some clarification as to how my workflow is actually constructed might be in order.</p>
<p>Basically, my workflow takes the folder selected in the Finder as input and assigns that input to the variable <span style="font-family:courier new;">&#8220;$@&#8221;</span>. That variable and the <span style="font-family:courier new;">for</span> loop in my workflow are automatically generated by Automator when you select “as arguments” from the “Pass input:” field in the “Do Shell Script” action. It’s how you get the context (the selected folder) passed to the script. Apparently Automator takes <span style="font-family:courier new;">“$@”</span> as the variable for “the folder you just selected” whenever there’s no input from a previous action. This was something I learned while fiddling around with all of this, and it&#8217;s really my favorite part. The coolest thing for me here, really, was figuring out how to pass the context — i.e. the right-clicked folder — to an Automator &#8220;Do Shell Script&#8221; action. This opens up worlds of potential.</p>
<p>Finally, as I said, the <span style="font-family:courier new;">for</span> loop in the action is auto-generated by Automator. The workflow will work almost as well with the simple script:<br />
<span style="font-family:courier new;">touch “$@/NewText.txt”</span></p>
<p>Using the <span style="font-family:courier new;">for</span> loop, however, allows you to create a new text file in multiple folders by selecting said folders and running the workflow.</p>
<p>It&#8217;s really kind of amazing how many ways there are to do this. Wow. Fun stuff.</p>
]]></content:encoded>
			<wfw:commentRss>http://systemsboy.com/2007/03/scripts-part-7-contextual-menus-with-automator.html/feed</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>Backing Up with RsyncX</title>
		<link>http://systemsboy.com/2006/12/backing-up-with-rsyncx.html</link>
		<comments>http://systemsboy.com/2006/12/backing-up-with-rsyncx.html#comments</comments>
		<pubDate>Mon, 04 Dec 2006 02:03:00 +0000</pubDate>
		<dc:creator>systemsboy</dc:creator>
				<category><![CDATA[Lab]]></category>
		<category><![CDATA[MacOSX]]></category>
		<category><![CDATA[NIX]]></category>
		<category><![CDATA[Scripts]]></category>
		<category><![CDATA[Systems]]></category>

		<guid isPermaLink="false">http://systemsboy.com/2006/12/backing-up-with-rsyncx/</guid>
		<description><![CDATA[In an earlier post I talked generally about my backup procedure for large amounts of data. In the post I discussed using RsyncX to back up staff Work drives over a network, as well as my own personal Work drive data, to a spare hard drive. Today I&#8217;d like to get a bit more specific. [...]]]></description>
			<content:encoded><![CDATA[<p>In an <a href="http://systemsboy.com/2006/06/on-backups.html">earlier post</a> I talked generally about my backup procedure for large amounts of data. In the post I discussed using RsyncX to back up staff Work drives over a network, as well as my own personal Work drive data, to a spare hard drive. Today I&#8217;d like to get a bit more specific.</p>
<p><span style="font-weight: bold;">Installing RsyncX</span><br />
I do not use, nor do I recommend the version of <span style="font-family:courier new;">rsync</span> that ships with Mac OS X 10.4. I&#8217;ve found it, in my own personal tests, to be extremely unreliable, and unreliability is the last thing you want in a backup program. Instead I use — and have been using without issue for years now — <a href="http://archive.macosxlabs.org/rsyncx/rsyncx.html">RsyncX</a>. RsyncX is a GUI wrapper for a custom-built version of the <span style="font-family:courier new;">rsync</span> command that&#8217;s made to properly deal with HFS+ resource forks. So the first thing you need to do is get RsyncX, which you can do <a href="http://archive.macosxlabs.org/rsyncx/rsyncx.html#download">here</a>. To install RsyncX, simply run the installer. This will place the resource-fork-aware version of <span style="font-family:courier new;">rsync</span> in <span style="font-family:courier new;">/usr/local/bin/</span>. If all you want to do is run <span style="font-family:courier new;">rsync</span> from the RsyncX GUI, then you&#8217;re done, but if you want to run it non-interactively from the command-line — which ultimately we do — you should put the newly installed <span style="font-family:courier new;">rsync</span> command in the standard location, which is <span style="font-family:courier new;">/usr/bin/</span>.¹ Before you do this, it&#8217;s always a good idea to make a backup of the OS X version. So:</p>
<div style="border: 1px solid #999999; overflow: auto; width: 100%; height: auto;">
<pre><span style="font-family:courier new;">sudo cp /usr/bin/rsync /usr/bin/rsync-ORIG</span>
<span style="font-family:courier new;">sudo cp /usr/local/bin/rsync /usr/bin/rsync</span></pre>
</div>
<p>Ah! Much better! Okay. We&#8217;re ready to roll with local backups.²</p>
<p><span style="font-weight: bold;">Local Backups</span><br />
Creating local backups with <span style="font-family:courier new;">rsync</span> is pretty straightforward. The RsyncX version of the command acts almost exactly like the standard *NIX version, except that it has an option to preserve HFS+ resource forks. This option must be provided if you&#8217;re interested in preserving said resource forks. Let&#8217;s take a look at a simple <span style="font-family:courier new;">rsync</span> command:</p>
<div style="border: 1px solid #999999; overflow: auto; width: 100%; height: auto;">
<pre><span style="font-family:courier new;">/usr/bin/rsync -a -vv /Volumes/Work/ /Volumes/Backup --eahfs</span></pre>
</div>
<p>This command will backup the contents of the Work volume to another volume called Backup. The <span style="font-family:courier new;">-a</span> flag stands for &#8220;archive&#8221; and will simply backup everything that&#8217;s changed while leaving files that may have been deleted from the source. It&#8217;s usually what you want. The <span style="font-family:courier new;">-vv</span> flag specifies &#8220;verbosity&#8221; and will print what <span style="font-family:courier new;">rsync</span> is doing to standard output. The level of verbosity is variable, so &#8220;<span style="font-family:courier new;">-v</span>&#8221; will give you only basic information, &#8220;<span style="font-family:courier new;">-vvvv</span>&#8221; will give you everything it can. I like &#8220;<span style="font-family:courier new;">-vv</span>.&#8221; That&#8217;s just the right amount of info for me. The next two entries are the source and target directories, Work and Backup. The <span style="font-family:courier new;">&#8211;eahfs</span> flag is used to tell <span style="font-family:courier new;">rsync</span> that you want to preserve resource forks. It only exists in the RsyncX version. Finally, pay close attention to the trailing slash in your source and target paths. The source path contains a trailing slash — meaning we want the command to act on the drive&#8217;s <span style="font-style: italic;">contents</span>, not the drive itself — whereas the target path contains no trailing slash. Without the trailing slash on the source, a folder called &#8220;Work&#8221; will be created inside the WorkBackup drive. This trailing slash behavior is standard in *NIX, but it&#8217;s important to be aware of when writing <span style="font-family:courier new;">rsync</span> commands.</p>
<p>That&#8217;s pretty much it for simple local backups. There are numerous other options to choose from, and you can find out about them by reading the <span style="font-family:courier new;">rsync man</span> page.</p>
<p><span style="font-weight: bold;">Network Backups</span><br />
One of the great things about <span style="font-family:courier new;">rsync</span> is its ability to perform operations over a network. This is a big reason I use it at work to back up staff machines. The <span style="font-family:courier new;">rsync</span> command can perform network backups over a variety of protocols, most notably SSH. It also can reduce the network traffic these backups require by only copying the changes to files, rather than whole changed files, as well as using compression for network data transfers.</p>
<p>The version of <span style="font-family:courier new;">rsync</span> used by the host machine and the client machine must match exactly. So before we proceed, copy <span style="font-family:courier new;">rsync</span> to its default location on your client machine. You may want to back up the Mac OS X version on your client as well. If you have root on both machines you can do this remotely on the command line:</p>
<div style="border: 1px solid #999999; overflow: auto; width: 100%; height: auto;">
<pre><span style="font-family:courier new;">ssh -t root@mac01.systemsboy.com 'cp /usr/bin/rsync /usr/bin/rsync-ORIG'</span>
<span style="font-family:courier new;">scp /usr/bin/rsync root@mac01.systemsboy.com:/usr/bin/</span></pre>
</div>
<p>Backing up over the network isn&#8217;t too much different or harder than backing up locally. There are just a few more flags you need to supply. But the basic idea is the same. Here&#8217;s an example:</p>
<div style="border: 1px solid #999999; overflow: auto; width: 100%; height: auto;">
<pre><span style="font-family:courier new;">/usr/bin/rsync -az -vv -e SSH mac01.systemsboy.com:/Volumes/Work/ /Volumes/Backups/mac01 --eahfs</span></pre>
</div>
<p>This is pretty similar to our local command. The <span style="font-family:courier new;">-a</span> flag is still there, and we&#8217;ve added the <span style="font-family:courier new;">-z</span> flag as well, which specifies to use compression for the data (to ease network traffic). We now also have an <span style="font-family:courier new;">-e</span> flag which tells <span style="font-family:courier new;">rsync</span> that we&#8217;re running over a network, and an <span style="font-family:courier new;">SSH</span> option that specifies the protocol to use for this network connection. Next we have the source, as usual, but this time our source is a computer on our network, which we specify just like we would with any <span style="font-family:courier new;">SSH</span> connection — <span style="font-family:courier new;">hostname:/Path/To/Volume</span>. Finally, we have the <span style="font-family:courier new;">&#8211;eahfs</span> flag for preserving resource forks. The easiest thing to do here is to run this as root (either directly or with <span style="font-family:courier new;">sudo</span>), which will allow you to sync data owned by users other than yourself.</p>
<p><span style="font-weight: bold;">Unattended Network Backups</span><br />
Running backups over the network can also be</p>
<p>completely automated and can run transparently in the background even on systems where no user is logged in to the Mac OS X GUI. Doing this over SSH, of course, requires an SSH connection that does not interactively prompt for a password. This can be accomplished by establishing authorized key pairs between host and client. The best resource I&#8217;ve found for learning how to do this is <a href="http://www.bombich.com/mactips/rsync.html">Mike Bombich&#8217;s page on the subject</a>. He does a better job explaining it than I ever could, so I&#8217;ll just direct you there for setting up SSH authentication keys. Incidentally, that article is written with <span style="font-family:courier new;">rsync</span> in mind, so there are lots of good <span style="font-family:courier new;">rsync</span> resources there as well. Go read it now, if you haven&#8217;t already. Then come back here and I&#8217;ll tell you what I do.</p>
<p>I&#8217;d like to note, at this point, that enabling SSH authentication keys, root accounts and unattended SSH access is a minor security risk. Bombich discusses this on his page to some extent, and I want to reiterate it here. Suffice to say, I would only use this procedure on a trusted, firewalled (or at least NATed) network. Please bear this in mind if you proceed with the following steps. If you&#8217;re uncomfortable with any of this, or don&#8217;t fully understand the implications, skip it and stick with local backups, or just run <span style="font-family:courier new;">rsync</span> over the network by hand and provide passwords as needed. But this is what <span style="font-style: italic;">I</span> do on <span style="font-style: italic;">our</span> network. It works, and it&#8217;s not terribly insecure.</p>
<p>Okay, once you have authentication keys set up, you should be able to log into your client machine from your server, as root, without being prompted for a password. If you can&#8217;t, reread the <a href="http://www.bombich.com/mactips/rsync.html">Bombich article</a> and try again until you get it working. Otherwise, unattended backups will fail. Got it? Great!</p>
<p>I enable the root account on both the host and client systems, which can be done with the NetInfo Manger application in <span style="font-family:courier new;">/Applications/Utilities/.</span> I do this because I&#8217;m backing up data that is not owned by my admin account, and using root gives me the unfettered access I need. Depending on your situation, this may or may not be necessary. For the following steps, though,  it will simplify things immensely if you are root:</p>
<div style="border: 1px solid #999999; overflow: auto; width: 100%; height: auto;">
<pre><span style="font-family:courier new;">su - root</span></pre>
</div>
<p>Now, as root, we can run our <span style="font-family:courier new;">rsync</span> command, minus the verbosity, since we&#8217;ll be doing this unattended, and if the keys are set up properly, we should never be prompted for a password:</p>
<div style="border: 1px solid #999999; overflow: auto; width: 100%; height: auto;">
<pre><span style="font-family:courier new;">/usr/bin/rsync -az -e SSH mac01.systemsboy.com:/Volumes/Work/ /Volumes/Backups/mac01 --eahfs</span></pre>
</div>
<p>This command can be run either directly from <span style="font-family:courier new;">cron</span> on a periodic basis, or it can be placed in a <span style="font-family:courier new;">cron</span>-run script. For instance, I have a script that pipes verbose output to a log of all <span style="font-family:courier new;">rsync</span> activity for each staff machine I back up. This is handy to check for errors and whatnot, every so often, or if there&#8217;s ever a problem. Also, my <span style="font-family:courier new;">rsync</span> commands are getting a bit unwieldy (as they tend to do) for direct inclusion in a <span style="font-family:courier new;">crontab</span>, so having the scripts keeps my <span style="font-family:courier new;">crontab</span> clean and readable. Here&#8217;s a variant, for instance, that directs the output of <span style="font-family:courier new;">rsync</span> to a text file, and that uses an exclude flag to prevent certain folders from being backed up:</p>
<div style="border: 1px solid #999999; overflow: auto; width: 100%; height: auto;">
<pre><span style="font-family:courier new;">/usr/bin/rsync -az -vv -e SSH --exclude "Archive" mac01.systemsboy.com:/Volumes/Work/ /Volumes/Backups/mac01 --eahfs &gt; ~/Log/mac01-backup-log.txt</span></pre>
</div>
<p>This exclusion flag will prevent backup of anything called &#8220;Archive&#8221; on the top level of mac01&#8242;s Work drive. Exclusion in <span style="font-family:courier new;">rsync</span> is relative to the source directory being synced. For instance, if I wanted to exclude a folder called &#8220;Do Not Backup&#8221; inside the &#8220;Archive&#8221; folder on mac01&#8242;s Work drive, my <span style="font-family:courier new;">rsync</span> command would look like this:</p>
<div style="border: 1px solid #999999; overflow: auto; width: 100%; height: auto;">
<pre><span style="font-family:courier new;">/usr/bin/rsync -az </span><span><span style="font-family:courier new;">-vv </span></span><span style="font-family:courier new;">-e SSH --exclude "Archive/Do Not Backup" mac01.systemsboy.com:/Volumes/Work/ /Volumes/Backups/mac01 --eahfs</span><span><span style="font-family:courier new;"> &gt; ~/Log/mac01-backup-log.txt</span></span></pre>
</div>
<p><span style="font-weight: bold;">Mirroring</span><br />
The above uses of <span style="font-family:courier new;">rsync</span>, as I mentioned before, will not delete files from the target that have been deleted from the source. They will only propagate changes that have occurred on the existing files, but will leave deleted files alone. They are semi-non-destuctive in this way, and this is often useful and desirable. Eventually, though, <span style="font-family:courier new;">rsync</span> backups will begin to consume a great deal of space, and after a while you may begin to run out. My solution to this is to periodically mirror my sources and targets, which can be easily accomplished with the <span style="font-family:courier new;">&#8211;delete</span> option. This option will delete any file from the target not found on the source. It does this after all other syncing is complete, so it&#8217;s fairly safe to use, but it will require enough drive space to do a full sync before it does its thing. Here&#8217;s our network command from above, only this time using the <span style="font-family:courier new;">&#8211;delete</span> flag:</p>
<div style="border: 1px solid #999999; overflow: auto; width: 100%; height: auto;">
<pre><span style="font-family:courier new;">/usr/bin/rsync -az -vv -e SSH --exclude "Archive/Do Not Backup" mac01.systemsboy.com:/Volumes/Work//Volumes/Backups/mac01 --delete --eahfs</span><span><span style="font-family:courier new;"> &gt; ~/Log/mac01-backup-log.txt</span></span></pre>
</div>
<p>Typically, I run the straight <span style="font-family:courier new;">rsync</span> command every other day or so (though I could probably get away with running it daily). I create the mirror at the end of each month to clear space. I back up about a half dozen machines this way, all from two simple shell scripts (daily and weekly) called by <span style="font-family:courier new;">cron</span>.</p>
<p><span style="font-weight: bold;">Conclusion</span><br />
I realize that this is not a perfect backup solution. But it&#8217;s pretty good for our needs, given what we can afford. And so far it hasn&#8217;t failed me yet in four years. That&#8217;s not a bad track record. Ideally, we&#8217;d have more drives and we&#8217;d stagger backups in such a way that we always had at least a few days backup available for retrieval. We&#8217;d also probably have some sort of backup to a more archival medium, like tape, for more permanent or semi-permanent backups. We&#8217;d also probably keep a copy of all this in some offsite, fireproof lock box. I know, I know. But we don&#8217;t. And we won&#8217;t. And thank god, &#8217;cause what a pain in the<br />
ass that must be. It&#8217;d be a full time job all its own, and not a very fun one. What this solution does offer is a cheap, decent, short-term backup procedure for emergency recovery of catastrophic data loss. Hard drive fails? No trouble. We&#8217;ve got you covered.</p>
<p>Hopefully, though, this all becomes a thing of the past when Leopard&#8217;s <a href="http://www.apple.com/macosx/leopard/timemachine.html">Time Machine</a> debuts. Won&#8217;t that be the shit?</p>
<p><a id="001" name="001"></a><span style="font-size:85%;">1. According to the RsyncX documentation, you should not need to do this, because the RsyncX installer changes the command path to its custom location. But if you&#8217;ll be running the command over the network or as root, you&#8217;ll either have to change that command path for the root account and on every client, or network backups will fail. It&#8217;s much easier to simply put the modified version in the default location on each machine.</span></p>
<p><a id="002" name="002"></a><span style="font-size:85%;">2. Updates to Mac OS X will almost always overwrite this custom version of <span style="font-family:courier new;">rsync</span>. So it&#8217;s important to remember to replace it whenever you update the system software.<br />
</span></p>
]]></content:encoded>
			<wfw:commentRss>http://systemsboy.com/2006/12/backing-up-with-rsyncx.html/feed</wfw:commentRss>
		<slash:comments>18</slash:comments>
		</item>
		<item>
		<title>Scripts Part 6: Archiver</title>
		<link>http://systemsboy.com/2006/11/scripts-part-6-archiver.html</link>
		<comments>http://systemsboy.com/2006/11/scripts-part-6-archiver.html#comments</comments>
		<pubDate>Thu, 30 Nov 2006 19:14:00 +0000</pubDate>
		<dc:creator>systemsboy</dc:creator>
				<category><![CDATA[Scripts]]></category>
		<category><![CDATA[ScriptSharing]]></category>

		<guid isPermaLink="false">http://systemsboy.com/2006/11/scripts-part-6-archiver/</guid>
		<description><![CDATA[A hint on MacOSXHints yesterday discussed using tar to create backups in Mac OS X. The poster was frustrated with the OS X-bundled version of the zip command, and confused by the way the Finder creates .zip files. Indeed, the Finder does not use the zip command to create its .zip files, and indeed it [...]]]></description>
			<content:encoded><![CDATA[<p>A <a href="http://www.macosxhints.com/article.php?story=20061128120143184">hint on MacOSXHints yesterday</a> discussed using <span style="font-family:courier new;">tar</span> to create backups in Mac OS X. The poster was frustrated with the OS X-bundled version of the <span style="font-family: courier new;">zip</span> command, and confused by the way the Finder creates .zip files. Indeed, the Finder does not use the <span style="font-family: courier new;">zip</span> command to create its .zip files, and indeed it is confusing. And, more importantly, the <span style="font-family: courier new;">zip</span> command does not preserve all-impotant Mac OS X resource forks.</p>
<p>After reading this hint I was reminded of a script I wrote a while back based on yet <a href="http://www.macosxhints.com/article.php?story=20031118111144197">another</a> MacOSXHints hint that uses <span style="font-family: courier new;">ditto</span> to create Finder-like .zip archives. So it seemed like a good time to post the script here and add it to the waning <a href="http://systemsboy.com/category/ScriptSharing">ScriptSharing</a> series.</p>
<p>So here it is: my Archive script. It will both archive and expand folders or files using ditto, and it places these archives on the Desktop.</p>
<p><a href="http://systemsboy.com/archive/Archiver.command.zip">Archiver Script</a><br /><a href="http://systemsboy.com/archive/Archiver.command">See the code</a></p>
]]></content:encoded>
			<wfw:commentRss>http://systemsboy.com/2006/11/scripts-part-6-archiver.html/feed</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Using SSH to Send Variables in Scripts</title>
		<link>http://systemsboy.com/2006/11/using-ssh-to-send-variables-in-scripts.html</link>
		<comments>http://systemsboy.com/2006/11/using-ssh-to-send-variables-in-scripts.html#comments</comments>
		<pubDate>Wed, 22 Nov 2006 20:12:00 +0000</pubDate>
		<dc:creator>systemsboy</dc:creator>
				<category><![CDATA[NIX]]></category>
		<category><![CDATA[Scripts]]></category>
		<category><![CDATA[Systems]]></category>

		<guid isPermaLink="false">http://systemsboy.com/2006/11/using-ssh-to-send-variables-in-scripts/</guid>
		<description><![CDATA[In July I posted an article about sending commands remotely via ssh. This has been immensely useful, but one thing I really wanted to use it for did not work. Sending an ssh command that contained a variable, via a script for instance, would always fail for me, because, of course, the remote machine didn&#8217;t [...]]]></description>
			<content:encoded><![CDATA[<p>In July I posted an article about <a href="http://systemsboy.com/2006/07/send-remote-commands-via-ssh.html">sending commands remotely via <span style="font-family:courier new;">ssh</span></a>. This has been immensely useful, but one thing I really wanted to use it for did not work. Sending an <span style="font-family:courier new;">ssh</span> command that contained a variable, via a script for instance, would always fail for me, because, of course, the remote machine didn&#8217;t know what the variable was.</p>
<p>Let me give an example. I have a script that creates user accounts. At the beginning of the script it asks me to supply a username, among other things, and assigns this to a variable in the script called <span style="font-family:courier new;">$username</span>. Kinda like this:</p>
<div style="border: 1px solid rgb(153, 153, 153); overflow: auto; width: 100%; height: auto;">
<pre><code><span style="font-size:85%;"><span style="font-family:courier new;">echo "Please enter the username for the new user:"read username</span></span></code></pre>
</div>
<p>Later  in the script that variable gets called to set the new user&#8217;s username, and a whole bunch of other parameters. Still later in the script, I need to send a command to a remote machine via <span style="font-family:courier new;">ssh</span>, and the command I&#8217;m sending contains the <span style="font-family:courier new;">$username</span> variable:</p>
<div style="border: 1px solid rgb(153, 153, 153); overflow: auto; width: 100%; height: auto;">
<pre><code><span style="font-size:85%;"><span style="font-family:courier new;">ssh root@home.account.server 'edquota -p systemsboy $username'</span></span></code></pre>
</div>
<p>This command would set the quota of the new user <span style="font-family:courier new;">$username</span> on the remote machine to that of the user systemsboy. But every time I&#8217;ve tried to include this command in the script, it fails, which, if you think about it, makes a whole lot of sense. See, &#8217;cause the remote machine doesn&#8217;t know squat about my script, and when that command gets to the remote machine, the remote machine has no idea who in the hell <span style="font-family:courier new;">$username</span> is. The remote machine reads <span style="font-family:courier new;">$username</span> literally, and the command fails.</p>
<p>The solution to this is probably obvious to hard-core scripters, but it took me a bit of thinkin&#8217; to figure it out. The solution is to create a new variable that is comprised of the <span style="font-family:courier new;">ssh</span> command calling the <span style="font-family:courier new;">$username</span> variable, and then call the new variable (the entire command) in the script. Which looks a little something like this:</p>
<div style="border: 1px solid rgb(153, 153, 153); overflow: auto; width: 100%; height: auto;">
<pre><code><span style="font-size:85%;"><span style="font-family:courier new;">quota=`ssh -t root@home.account.server "edquota -p systemsboy $username"`echo "$quota"</span></span></code></pre>
</div>
<p>So we&#8217;ve created a variable, called <span style="font-family:courier new;">$quota</span>, which is the entire <span style="font-family:courier new;">ssh</span> command, and then we&#8217;ve simply called that variable in the script. That <span style="font-family:courier new;">$quota</span> variable will have the <span style="font-family:courier new;">$username</span> variable already filled in, and the command will now succeed on the remote machine. One thing that&#8217;s important to note here: generally the command being sent over <span style="font-family:courier new;">ssh</span> is enclosed in single-quotes. In this instance, however, it must be enclosed in double-quotes for the command to work. I also used the <span style="font-family:courier new;">-t</span> option in this example (which tells <span style="font-family:courier new;">ssh</span> that the session is interactive, and to wait until it&#8217;s told to return to the local machine) but I don&#8217;t actually think it&#8217;s necessary in this case. Still, it shouldn&#8217;t hurt to have it there, just in case something goes funky.</p>
<p>But so far nothing has gone funky. This seems to work great.</p>
]]></content:encoded>
			<wfw:commentRss>http://systemsboy.com/2006/11/using-ssh-to-send-variables-in-scripts.html/feed</wfw:commentRss>
		<slash:comments>27</slash:comments>
		</item>
		<item>
		<title>Send Remote Commands Via SSH</title>
		<link>http://systemsboy.com/2006/07/send-remote-commands-via-ssh.html</link>
		<comments>http://systemsboy.com/2006/07/send-remote-commands-via-ssh.html#comments</comments>
		<pubDate>Fri, 07 Jul 2006 22:22:00 +0000</pubDate>
		<dc:creator>systemsboy</dc:creator>
				<category><![CDATA[NIX]]></category>
		<category><![CDATA[Scripts]]></category>
		<category><![CDATA[Systems]]></category>

		<guid isPermaLink="false">http://systemsboy.com/2006/07/send-remote-commands-via-ssh/</guid>
		<description><![CDATA[This is one of those &#8220;I&#8217;m posting it so I remember, &#8217;cause I keep forgetting&#8221; posts. It&#8217;s also astoundingly cool, though, if you didn&#8217;t know about it. Which I didn&#8217;t until fairly recently. If you&#8217;ve ever wanted to send a command to a remote computer without ever actually logging in to that computer, ssh is [...]]]></description>
			<content:encoded><![CDATA[<p>This is one of those &#8220;I&#8217;m posting it so I remember, &#8217;cause I keep forgetting&#8221; posts. It&#8217;s also astoundingly cool, though, if you didn&#8217;t know about it. Which I didn&#8217;t until fairly recently.</p>
<p>If you&#8217;ve ever wanted to send a command to a remote computer without ever actually logging in to that computer, <span style="font-family:courier new;">ssh</span> is your friend. Yes, with <span style="font-family:courier new;">ssh</span> you can send commands directly to another system. Who knew?</p>
<p>I&#8217;ll keep this short and sweet. Here are some examples.</p>
<p>The basic form looks something like this:</p>
<div style="border: 1px solid #999999; overflow: auto; width: 100%; height: auto;">
<pre><code><span style="font-size:85%;"><span style="font-family:courier new;">ssh systemsboy@rhost.systemsboy.edu 'ls -l'</span></span></code></pre>
</div>
<p>where &#8220;<span style="font-family:courier new;">systemsboy</span>&#8221; is actually your username on the remote host, and &#8220;<span style="font-family:courier new;">rhost.systemsboy.edu</span>&#8221; is your remote system. The command you&#8217;re sending is contained in single quotes.</p>
<p>Here is an example sending multiple commands:</p>
<div style="border: 1px solid #999999; overflow: auto; width: 100%; height: auto;">
<pre><code><span style="font-size:85%;"><span style="font-family:courier new;">ssh systemsboy@rhost.systemsboy.edu 'ls -l; ps -aux; whoami'</span></span></code></pre>
</div>
<p>wherein each command is separated by a semicolon.</p>
<p>Finally, here is an example sending a command that requires user interaction:</p>
<div style="border: 1px solid #999999; overflow: auto; width: 100%; height: auto;">
<pre><code><span style="font-size:85%;"><span style="font-family:courier new;">ssh -t systemsboy@rhost.systemsboy.edu 'top'</span></span></code></pre>
</div>
<p>Note the <span style="font-family:courier new;">-t</span> flag. That tells <span style="font-family:courier new;">ssh</span> that you&#8217;ll be interacting with remote shell. Without the <span style="font-family:courier new;">-t</span> flag <span style="font-family:courier new;">top</span> will return results after which <span style="font-family:courier new;">ssh</span> will log you out of the remote host immediately. With the <span style="font-family:courier new;">-t</span> flag, <span style="font-family:courier new;">ssh</span> keeps you logged in until you exit the interactive command. The <span style="font-family:courier new;">-t</span> flag can be used with most interactive commands, including text editors like <span style="font-family:courier new;">pico</span> and <span style="font-family:courier new;">vi</span>.</p>
<p>Sending remote commands via <span style="font-family:courier new;">ssh</span> is incredibly handy when writing shell scripts as it allows you to run your scripts locally even if those scripts are meant to effect changes on a remote machine. I just wrote a script, for instance, that sets up vacation mail forwarding for staff members. Without these remote commands I would have had to have staff members log directly onto the mail server and run the scripts from the command line, which I don&#8217;t think they&#8217;d be too happy about. With <span style="font-family:courier new;">ssh</span> remote commands, I can give them the scripts and they can run them right from their Desktops. Believe me, they much prefer this.</p>
<p>Credit where due, all information was obtained from <a href="http://www.nemein.com/people/rambo/ssh-tricks.html">Rambo&#8217;s post</a>. Rambo, thanks. Whoever you are.</p>
<p><strong>UPDATE:</strong><br />
For additional information about using this trick with variables within the remote command, see &#8220;<a href="http://systemsboy.com/2006/11/using-ssh-to-send-variables-in-scripts.html">Using SSH to Send Variables in Scripts</a>.&#8221;</p>
]]></content:encoded>
			<wfw:commentRss>http://systemsboy.com/2006/07/send-remote-commands-via-ssh.html/feed</wfw:commentRss>
		<slash:comments>19</slash:comments>
		</item>
		<item>
		<title>Scripting Filenames with Spaces: A for Replacement</title>
		<link>http://systemsboy.com/2006/04/scripting-filenames-with-spaces-a-for-replacement.html</link>
		<comments>http://systemsboy.com/2006/04/scripting-filenames-with-spaces-a-for-replacement.html#comments</comments>
		<pubDate>Thu, 27 Apr 2006 16:13:00 +0000</pubDate>
		<dc:creator>systemsboy</dc:creator>
				<category><![CDATA[NIX]]></category>
		<category><![CDATA[Scripts]]></category>

		<guid isPermaLink="false">http://systemsboy.com/2006/04/scripting-filenames-with-spaces-a-for-replacement/</guid>
		<description><![CDATA[Okay, this will be a quickie. Really. I use for loops in scripts all the time, but for chokes on files with spaces in the name. After years of finding ways to avoid this problem any way I could, I&#8217;ve finally found what I believe to be the solution. The for command treats any whitespace [...]]]></description>
			<content:encoded><![CDATA[<p>Okay, this will be a quickie. Really.</p>
<p>I use <span style="font-family:courier new;">for</span> loops in scripts all the time, but <span style="font-family:courier new;">for</span> chokes on files with spaces in the name. After years of finding ways to avoid this problem any way I could, I&#8217;ve finally found what I believe to be the solution.</p>
<p>The <span style="font-family:courier new;">for</span> command treats any whitespace as a line break. So if you try to use <span style="font-family:courier new;">for</span> on a list of files (or folders or whatever) the loop will not function properly on items with spaces in the name. The <span style="font-family:courier new;">for</span> command will treat everything after the space as a new item.</p>
<p>Let&#8217;s say you want to copy every file that starts with &#8220;<span style="font-family:courier new;">Systems</span>&#8221; in the folder &#8220;<span style="font-family:courier new;">Start</span>&#8221; to a folder called &#8220;<span style="font-family:courier new;">Finish</span>.&#8221; The &#8220;<span style="font-family:courier new;">Start</span>&#8221; folder contains the items:<br />
<span style="font-family:courier new;">Systems Boy</span><br />
<span style="font-family:courier new;">Systems Girl</span><br />
<span style="font-family:courier new;">Systems Baby</span><br />
<span style="font-family:courier new;">James Bond</span><br />
<span style="font-family:courier new;">Bat Man</span></p>
<p>Using <span style="font-family:courier new;">for</span> would go something like this:</p>
<div style="border: 1px solid #999999; overflow: auto; width: 100%; height: auto;">
<pre><code><span style="font-size:85%;"><span style="font-family:courier new;">for item in `ls Start | grep Systems`
   do cp "$item" Finish
done</span></span></code></pre>
</div>
<p>The <span style="font-family:courier new;">for</span> command, however, will treat &#8220;<span style="font-family:courier new;">Systems</span>&#8221; and &#8220;<span style="font-family:courier new;">Boy</span>&#8221; as two separate items, and when the <span style="font-family:courier new;">cp</span> command is issued it will complain:<br />
<span style="font-family:courier new;">cp: Systems: No such file or directory</span><br />
<span style="font-family:courier new;">cp: Baby: No such file or directory</span><br />
<span style="font-family:courier new;">cp: Systems: No such file or directory</span><br />
<span style="font-family:courier new;">cp: Boy: No such file or directory</span><br />
<span style="font-family:courier new;">cp: Systems: No such file or directory</span><br />
<span style="font-family:courier new;">cp: Girl: No such file or directory</span></p>
<p>The solution is to forego <span style="font-family:courier new;">for</span> and pipe your command to a <span style="font-family:courier new;">while read</span> statement like in the following example:</p>
<div style="border: 1px solid #999999; overflow: auto; width: 100%; height: auto;">
<pre><code><span style="font-size:85%;"><span style="font-family:courier new;">ls Start | grep Systems | while read item
   do cp "$item" Finish
done</span></span></code></pre>
</div>
<p>The quotes around the <span style="font-family:courier new;">$item</span> variable are essential. Without them the script will fail in the same way as <span style="font-family:courier new;">for</span>. With them, the script works like you wish the <span style="font-family:courier new;">for</span> loop did and is able to properly copy files with spaces in the names.</p>
<p>Nice. And by &#8220;nice&#8221; I mean halle-fuckin-lujah!</p>
<p>I should give some credit for this tip. I originally read about it <a href="http://www.macgeekery.com/tips/cli/handling_filenames_with_spaces_in_bash">here</a> at <a href="http://www.macgeekery.com/">MacGeekery</a>, but didn&#8217;t quite understand it until I read some <a href="http://www.unix.com/showthread.php?t=13892">posts</a> on various <a href="http://www.computing.net/unix/wwwboard/forum/7140.html">forums</a>. Of course, there&#8217;s nothing like a real-world problem to solve, and I had this as well to aid my understanding of this method.</p>
]]></content:encoded>
			<wfw:commentRss>http://systemsboy.com/2006/04/scripting-filenames-with-spaces-a-for-replacement.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Scripts Part 5: New Spotlight Disabler</title>
		<link>http://systemsboy.com/2006/03/scripts-part-5-new-spotlight-disabler.html</link>
		<comments>http://systemsboy.com/2006/03/scripts-part-5-new-spotlight-disabler.html#comments</comments>
		<pubDate>Sat, 04 Mar 2006 21:54:00 +0000</pubDate>
		<dc:creator>systemsboy</dc:creator>
				<category><![CDATA[Scripts]]></category>
		<category><![CDATA[ScriptSharing]]></category>
		<category><![CDATA[Tiger]]></category>

		<guid isPermaLink="false">http://systemsboy.com/2006/03/scripts-part-5-new-spotlight-disabler/</guid>
		<description><![CDATA[Someone recently commented that my script to disable Spotlight was no longer functioning in v. 10.4.5 of Tiger. When I went to check on the functionality of the old script, I realized I&#8217;d been working on a new and improved version awhile back, and that I&#8217;d intended to post it, but completely forgot to. So [...]]]></description>
			<content:encoded><![CDATA[<p>Someone recently commented that my <a href="http://systemsboy.com/2005/05/getting-back-to-search-basics.html">script to disable Spotlight</a> was no longer functioning in v. 10.4.5 of Tiger. When I went to check on the functionality of the old script, I realized I&#8217;d been working on a new and improved version awhile back, and that I&#8217;d intended to post it, but completely forgot to. So I went in and finished up this spiffy new version, and I&#8217;m posting it today for anyone who&#8217;s interested, or for anyone for whom the previous version had stopped working.</p>
<p>This new version comes with the same disclaimers as the other one (which are now listed in the script itself), but gives you a few more options for disabling Spotlight. In particular, you can now choose to disable/enable Spotlight on either a single volume, or an all volumes.  The script will also report the Spotlight status of all currently mounted volumes before asking you what you want to do.</p>
<p>Enjoy!</p>
<p><a href="http://systemsboy.com/archive/spotlightEnableDisable.command.zip">SpotlightEnableDisable Script</a><br /><a href="http://systemsboy.com/archive/spotlightEnableDisable.command">See the code</a></p>
]]></content:encoded>
			<wfw:commentRss>http://systemsboy.com/2006/03/scripts-part-5-new-spotlight-disabler.html/feed</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>Scripts Part 4: Cloning — What&#8217;s the Big Deal?</title>
		<link>http://systemsboy.com/2006/02/scripts-part-4-cloning-%e2%80%94-whats-the-big-deal.html</link>
		<comments>http://systemsboy.com/2006/02/scripts-part-4-cloning-%e2%80%94-whats-the-big-deal.html#comments</comments>
		<pubDate>Sun, 19 Feb 2006 08:35:00 +0000</pubDate>
		<dc:creator>systemsboy</dc:creator>
				<category><![CDATA[Scripts]]></category>
		<category><![CDATA[ScriptSharing]]></category>

		<guid isPermaLink="false">http://systemsboy.com/2006/02/scripts-part-4-cloning-%e2%80%94-whats-the-big-deal/</guid>
		<description><![CDATA[Boy, there sure are a lot of cloning apps out there. The mother of them all, of course, is Mike Bombich&#8217;s Carbon Copy Cloner, but it&#8217;s slowly losing mindshare to more aggressively marketed apps like the affable SuperDuper!. There are others, but I don&#8217;t feel like scouring the web for them, nor do I feel [...]]]></description>
			<content:encoded><![CDATA[<p>Boy, there sure are a lot of cloning apps out there. The mother of them all, of course, is <a href="http://www.bombich.com/">Mike Bombich&#8217;s</a> <a href="http://www.bombich.com/software/ccc.html">Carbon Copy Cloner</a>, but it&#8217;s slowly losing mindshare to more aggressively marketed apps like the affable <a href="http://www.shirt-pocket.com/SuperDuper/SuperDuperDescription.html">SuperDuper!</a>. There are others, but I don&#8217;t feel like scouring the web for them, nor do I feel like going to the effort of linking to them all. Suffice to say, there are plenty. Just search <a href="http://www.versiontracker.com/">VersionTracker</a> and you&#8217;ll see.</p>
<p>I find the recent upswing in cloning utilities strange. Apple&#8217;s bundled Disk Utility application has actually <a href="http://www.macosxhints.com/article.php?story=20031030154346917">harbored the ability to clone</a> a system disk for some time now (I believe as far back as Panther). And yet, it seems the easier cloning gets, the more apps there are with which to do it. And charge you for it.</p>
<p>Today&#8217;s script uses a handy command-line utility that&#8217;s actually been around since the Classic Mac OS days (though not, obviously, in command-line form): <span style="font-family:courier new;">asr</span>, which stands for Apple Software Restore. The <span style="font-family:courier new;">asr</span> command is essentially a command for cloning disks. In fact, that&#8217;s exactly what it is. When Mac OS X first came out, <span style="font-family:courier new;">asr</span> was not bundled. But in recent incarnations of the OS it&#8217;s hung around in the command-line, and it&#8217;s actually gotten quite refined and easy to use. Want to clone your boot drive? Here&#8217;s the command:</p>
<div style="border: 1px solid rgb(153, 153, 153); overflow: auto; width: 100%; height: auto;">
<pre><code><span style="font-size:85%;"><span style="font-family:courier new;">sudo asr -source [<span style="font-style: italic;">source_volume</span> ] -target [<span style="font-style: italic;">target_volume</span> ]</span></span></code></pre>
</div>
<p>That&#8217;s it. I can&#8217;t imagine an easier command structure. In a way, it&#8217;s almost easier to use than GUI apps that do the same thing. Of course you can get into some very complicated uses of <span style="font-family:courier new;">asr</span>, but for basic disk-to-disk cloning it&#8217;s drop-dead simple.</p>
<p>Now there is one little, tiny bump in this road. Tiger, you see, has a brand spanking new way of making certain files on your boot drive invisible. You know, files like <span style="font-family:courier new;">var</span> and <span style="font-family:courier new;">etc</span> and <span style="font-family:courier new;">private</span>. And Tiger&#8217;s version of <span style="font-family:courier new;">asr</span> (as well as Tiger&#8217;s Disk Utility program) are none the wiser. So, if you want things set up properly, you need to explicitly set the visibility of these files. There are a few ways to do this. Today&#8217;s script will use a utility called <span style="font-family:courier new;">SetHidden</span>, which comes on the Tiger install disc (a la this <a href="http://docs.info.apple.com/article.html?artnum=301677">Apple KB article</a>). Just so you know.</p>
<p>So here it is. A very simple script for making an exact clone of a volume to another volume. Please keep in mind, because of the file visibility issue, this script MUST be run from the disc image, or it will not work properly. Also keep in mind that cloning will overwrite, replace or even erase the target drive. I am in no way responsible for any damage you incur to your system with this script. If you don&#8217;t feel comfortable using it, please don&#8217;t.</p>
<p>That said, here&#8217;s your free cloning utility.</p>
<p><a href="http://systemsboy.com/archive/ASRClone.dmg.zip">Download ASRClone</a><span style="font-size:85%;"><br /><a href="http://del.icio.us/systemsboy/Scripts"> </a></span></p>
]]></content:encoded>
			<wfw:commentRss>http://systemsboy.com/2006/02/scripts-part-4-cloning-%e2%80%94-whats-the-big-deal.html/feed</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Delayed ACK Startup Item for Intel Macs</title>
		<link>http://systemsboy.com/2006/02/delayed-ack-startup-item-for-intel-macs.html</link>
		<comments>http://systemsboy.com/2006/02/delayed-ack-startup-item-for-intel-macs.html#comments</comments>
		<pubDate>Fri, 03 Feb 2006 23:03:00 +0000</pubDate>
		<dc:creator>systemsboy</dc:creator>
				<category><![CDATA[MacOSX]]></category>
		<category><![CDATA[Scripts]]></category>
		<category><![CDATA[ScriptSharing]]></category>
		<category><![CDATA[Tiger]]></category>

		<guid isPermaLink="false">http://systemsboy.com/2006/02/delayed-ack-startup-item-for-intel-macs/</guid>
		<description><![CDATA[MacFixit just reported about troubles the new Intel-based Macs are having with network speeds, particularly AFP connections to, of all things, other Macs. The solution, they report, is to set the delayed_ack property to 0. In order for this change to survive a reboot, however, they recommend editing /etc/rc. The problem with this is that, [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.macfixit.com/">MacFixit</a> just reported about <a href="http://www.macfixit.com/article.php?story=20060203081147368">troubles the new Intel-based Macs are having with network speeds</a>, particularly AFP connections to, of all things, other Macs. The solution, they report, is to set the <span style="font-family:courier new;">delayed_ack</span> property to <span style="font-family:courier new;">0</span>. In order for this change to survive a reboot, however, they recommend editing <span style="font-family:courier new;">/etc/rc</span>. The problem with this is that, often, edits made to <span style="font-family:courier new;">/etc/rc</span> will be overwritten by future updates to Mac OSX. In my experience, such modifications are better handled with a startup item, which is also a lot easier to add and remove. So I&#8217;ve suggested as much to the fine folks over at MacFixit, and I&#8217;ve even put my money where my mouth is. I&#8217;m offering to those who need it this delayedACK Startup Item, hand made by yours truly.</p>
<p>The linked disc image contains the delayedACK Startup Item, and also includes an installer and an uninstaller for the Startup Item.</p>
<p>Enjoy, you lucky Intel Mac owners (of which, alas, I am not one&#8230; Yet&#8230;)</p>
<p>UPDATE:<br />A reader called Nubo recently left this comment:<br />
<blockquote>&#8230;turning off delayed_ack is not necessarily something that should be left in the startup items forever. Having it on is normally beneficial or at least not severely degrading in normal environments. So this should be reviewed whenever Apple fixes the underlying problem in its implementation, or the actual root cause is found.</p></blockquote>
<p>Nubo is absolutely right. This startup item should be removed — either by running the included uninstaller or by simply dragging the startup item to the trash — once the problem has been resolved by Apple.</p>
<p>Thanks, Nubo, for pointing this out.</p>
<p><a href="http://systemsboy.com/archive/DelayedACKStartupItem.dmg">Download the Delayed ACK Startup Item</a><span style="font-size:85%;"><br /><a href="http://del.icio.us/systemsboy/Tiger"> </a></span></p>
]]></content:encoded>
			<wfw:commentRss>http://systemsboy.com/2006/02/delayed-ack-startup-item-for-intel-macs.html/feed</wfw:commentRss>
		<slash:comments>34</slash:comments>
		</item>
	</channel>
</rss>

<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Minified using disk: basic
Page Caching using disk: enhanced
Database Caching 1/46 queries in 0.034 seconds using disk: basic
Object Caching 578/668 objects using disk: basic

Served from: systemsboy.com @ 2012-02-04 16:27:17 -->
