<?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>totalnetsolutions.net &#187; Technology</title>
	<atom:link href="http://www.totalnetsolutions.net/category/tech/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.totalnetsolutions.net</link>
	<description>totalnetsolutions.net - Complete Networking Solutions for business</description>
	<lastBuildDate>Thu, 26 Jan 2012 04:05:18 +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>What date is XX days from today?</title>
		<link>http://www.totalnetsolutions.net/2012/01/25/what-date-is-xx-days-from-today/</link>
		<comments>http://www.totalnetsolutions.net/2012/01/25/what-date-is-xx-days-from-today/#comments</comments>
		<pubDate>Thu, 26 Jan 2012 03:30:27 +0000</pubDate>
		<dc:creator>Robert</dc:creator>
				<category><![CDATA[HowTo]]></category>
		<category><![CDATA[Open Source Software]]></category>
		<category><![CDATA[Unix]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[perl]]></category>

		<guid isPermaLink="false">http://www.totalnetsolutions.net/?p=89</guid>
		<description><![CDATA[A quick CLI reference for perl people&#8230; perl -e ' my @t=localtime(time() + $ARGV[0]*24*60*60); $t[4]++; $t[5]+=1900; print "$t[4]/$t[3]/$t[5]\n";' XX I&#8217;ve needed this 2x today already, and hope it helps you! Edit: Someone made a comment, as people on the internet are prone to do, so here&#8217;s the long-form non-one-liner version: #!/usr/bin/perl my $addDays = shift; [...]]]></description>
			<content:encoded><![CDATA[<p>A quick CLI reference for perl people&#8230;<br />
<code><br />
perl -e ' my @t=localtime(time() + $ARGV[0]*24*60*60); $t[4]++; $t[5]+=1900; print "$t[4]/$t[3]/$t[5]\n";' XX<br />
</code><br />
I&#8217;ve needed this 2x today already, and hope it helps you!</p>
<p>Edit:<br />
Someone made a comment, as people on the internet are prone to do, so here&#8217;s the long-form non-one-liner version:</p>
<p><code><br />
#!/usr/bin/perl<br />
my $addDays = shift;<br />
my ($second, $minute, $hour, $day, $month, $year, $dayOfWeek, $dayOfYear, $daylightSavings) = localtime(time());<br />
my ($fsecond, $fminute, $fhour, $fday, $fmonth, $fyear, $fdayOfWeek, $fdayOfYear, $fdaylightSavings) = localtime(time() + $addDays*24*60*60);</p>
<p>#fix 0 = 1 values, and "0 = 1900" problem:<br />
$month++;<br />
$fmonth++;<br />
$year+=1900;<br />
$fyear+=1900;</p>
<p>print "today is:                    $month/$day/$year\n";<br />
print "$addDays days from today is: $fmonth/$fday/$fyear\n";<br />
</code></p>
<p>Run it as:<br />
<code><br />
rob@laptop:~$ fdate.pl 50<br />
today is:              1/25/2012<br />
50 days from today is: 3/15/2012<br />
</code></p>
]]></content:encoded>
			<wfw:commentRss>http://www.totalnetsolutions.net/2012/01/25/what-date-is-xx-days-from-today/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Dynamic MTU in Debian/Ubuntu</title>
		<link>http://www.totalnetsolutions.net/2011/10/05/dynamic-mtu-in-debianubuntu/</link>
		<comments>http://www.totalnetsolutions.net/2011/10/05/dynamic-mtu-in-debianubuntu/#comments</comments>
		<pubDate>Wed, 05 Oct 2011 19:53:00 +0000</pubDate>
		<dc:creator>Robert</dc:creator>
				<category><![CDATA[HowTo]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Networking]]></category>

		<guid isPermaLink="false">http://www.totalnetsolutions.net/?p=85</guid>
		<description><![CDATA[I know it&#8217;s probably an unusual situation, but in the lab we have Jumbo frames turned on for all the servers and test boxes. It makes a huge difference copying ISOs between hosts, and doing network backups. However, my Kubuntu laptop isn&#8217;t always in the lab network. This means that I almost never remember to [...]]]></description>
			<content:encoded><![CDATA[<p>I know it&#8217;s probably an unusual situation, but in the lab we have Jumbo frames turned on for all the servers and test boxes.  It makes a huge difference copying ISOs between hosts, and doing network backups.  However, my Kubuntu laptop isn&#8217;t always in the lab network.  This means that I almost never remember to change the MTU when I&#8217;m back in the office, OR I remember in the middle of a transfer, when it&#8217;s already too late to gain the benefits.</p>
<p>So I wrote a little script, and put it in /etc/network/if-up.d/ named &#8220;jumbo-frames.sh&#8221;.  The if-*.d/ structure is designed for exactly this purpose: run a script when an interface comes up.  The basic premise is: If I&#8217;m plugged into a wired network (eth0) in the lab (domain or IP address match certain parameters), then set the MTU to 9000 (jumbo frame support), otherwise assume the network has a normal MTU (1500).  This allows the system to reconfigure on the fly if I put it to sleep and go visit a customer.</p>
<p>Here&#8217;s the code:<br />
<code><br />
#!/bin/sh<br />
# Set support for jumbo frames when at home on wired network, else do not.<br />
# Determine home network based on IP address and DNS-determined name.<br />
# $IFACE should be set by the caller.</p>
<p>PATH=/sbin:/bin:/usr/sbin:/usr/bin</p>
<p>IFC=/sbin/ifconfig<br />
INT="eth0"<br />
MTU=9000<br />
DEFMTU=1500<br />
#name of the DNS domain to assume as "home"<br />
HOMED="totalnetsolutions.net"<br />
#IP Subnet to assume as "home" if DNS test fails<br />
HOMEN="10.0.0."</p>
<p>test -x $IFC || exit 0</p>
<p># Don't make changes to the wireless (wlan) or loopback (lo) interfaces<br />
if [ "$IFACE" != "$INT" ]; then<br />
    exit 0<br />
fi</p>
<p># if dhcpd is still working on writing our resolv.conf, just wait a while (it's a hack, but it works).<br />
test -f /etc/resolv.conf || sleep 15</p>
<p>DOM=`awk '/search/ { print $2 }' /etc/resolv.conf`<br />
NET=`ip addr show dev $IFACE | awk '/inet / { print $2 }' | awk -F. '{ print $1 "." $2 "." $3 "." }'`</p>
<p>if [ "$DOM" = "$HOMED" ]; then<br />
    $IFC $IFACE mtu $MTU<br />
elif [ "$NET" = "$HOMEN" ]; then<br />
    $IFC $IFACE mtu $MTU<br />
else<br />
    $IFC $IFACE mtu $DEFMTU<br />
fi<br />
</code></p>
]]></content:encoded>
			<wfw:commentRss>http://www.totalnetsolutions.net/2011/10/05/dynamic-mtu-in-debianubuntu/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>HowTo: Create a dummy / empty / blank krb5.keytab file</title>
		<link>http://www.totalnetsolutions.net/2011/07/07/howto-create-a-dummy-empty-blank-krb5-keytab-file/</link>
		<comments>http://www.totalnetsolutions.net/2011/07/07/howto-create-a-dummy-empty-blank-krb5-keytab-file/#comments</comments>
		<pubDate>Fri, 08 Jul 2011 03:29:39 +0000</pubDate>
		<dc:creator>Robert</dc:creator>
				<category><![CDATA[HowTo]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Unix]]></category>
		<category><![CDATA[howto technology linux]]></category>

		<guid isPermaLink="false">http://www.totalnetsolutions.net/?p=80</guid>
		<description><![CDATA[We had an issue recently where we needed a dummy krb5.keytab file for an operation prior to creating the real keytab: echo -e "\0005\0002\c" >/etc/krb5.keytab]]></description>
			<content:encoded><![CDATA[<p>We had an issue recently where we needed a dummy krb5.keytab file for an operation prior to creating the real keytab:<br />
<code>echo -e "\0005\0002\c" >/etc/krb5.keytab</code></p>
]]></content:encoded>
			<wfw:commentRss>http://www.totalnetsolutions.net/2011/07/07/howto-create-a-dummy-empty-blank-krb5-keytab-file/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How To: Test SMTP by hand</title>
		<link>http://www.totalnetsolutions.net/2011/06/21/howto-test-smtp-by-hand/</link>
		<comments>http://www.totalnetsolutions.net/2011/06/21/howto-test-smtp-by-hand/#comments</comments>
		<pubDate>Wed, 22 Jun 2011 02:10:27 +0000</pubDate>
		<dc:creator>Robert</dc:creator>
				<category><![CDATA[Exchange]]></category>
		<category><![CDATA[HowTo]]></category>

		<guid isPermaLink="false">http://www.totalnetsolutions.net/?p=79</guid>
		<description><![CDATA[I recently had a co-worker trying to figure out a &#8220;lost email&#8221; problem we were possibly experiencing. He was blind to everything after hitting &#8220;send&#8221; because the intermediate servers weren&#8217;t sending delivery recipets, even though they were requested in the MIME header (Does any mail admin allow those to be sent out of the organization [...]]]></description>
			<content:encoded><![CDATA[<p>I recently had a co-worker trying to figure out a &#8220;lost email&#8221; problem we were possibly experiencing.  He was blind to everything after hitting &#8220;send&#8221; because the intermediate servers weren&#8217;t sending delivery recipets, even though they were requested in the MIME header (Does any mail admin allow those to be sent out of the organization these days?)  So, to help him out, I wrote up the following &#8220;how to test SMTP by hand&#8221; HOWTO.</p>
<p>First step is to determine which servers are responsible for mail delivery inbound for the domain you&#8217;re sending to.  You do this by looking in DNS for the &#8220;MX&#8221; type records.  These are provided in the format &#8220;priority servername.domain.&#8221;  Priority is reverse-ordered.  The easiest way to remember priority order is that it&#8217;s the order in which servers are attempted.<br />
<code><br />
rob@rob-kubuntu3:~$ dig MX totalnetsolutions.net +short<br />
10 docsmooth.isa-geek.net.<br />
rob@rob-kubuntu3:~$ dig MX likewise.com +short<br />
10 server1.inboundmx.com.<br />
20 server2.inboundmx.com.<br />
</code><br />
This tells you the servers, in order, that *all* mail will be sent to for the domain listed.  So, anything to my likewise.com address will go to server1.inboundmx.com.  The higher priorities are only used if the lower priorities fail to answer.  If no server answers, the mail is held by the sender and retried, generally every 1 or 4 hours for up to 4 days, but this retry is configured on the *sending* server.  That means, your own email admin (or you, if you&#8217;re the mail admin).</p>
<p>Next thing to check is: does the server work, and is it your sender, or their receiver?  Check with telnet!<br />
Stuff I type is in red:<br />
<code><br />
rob@rob-kubuntu3:~$ <span style="color:red;">telnet docsmooth.isa-geek.net 25</span><br />
Trying 99.29.179.119...<br />
Connected to docsmooth.isa-geek.net.<br />
Escape character is '^]'.<br />
220 totalnetsolutions.net Microsoft ESMTP MAIL Service, Version: 6.0.3790.4675 ready at  Tue, 31 May 2011 08:43:08 -0500<br />
<span style="color:red;">HELO</span><br />
250 totalnetsolutions.net Hello [12.130.116.175]<br />
<span style="color:red;">MAIL FROM: me@me.com</span><br />
250 2.1.0 me@me.com....Sender OK<br />
<span style="color:red;">RCPT TO:you@you.net</span><br />
250 2.1.5 you@you.net<br />
<span style="color:red;">DATA</span><br />
354 Start mail input; end with <crlf>.</crlf><crlf><br />
<span style="color:red;">from:me@me.com<br />
to:you@you.net<br />
subject:test manually<br />
test<br />
test<br />
.</span><br />
250 2.6.0 <tns03suzbbd2j9jsmmx00000039 @totalnetsolutions.net> Queued mail for delivery<br />
<span style="color:red;">quit</span><br />
221 2.0.0 totalnetsolutions.net Service closing transmission channel<br />
Connection closed by foreign host.<br />
</tns03suzbbd2j9jsmmx00000039></crlf></code><br />
The last &#8220;.&#8221; is SUPER important &#8211; it tells the mail server when you&#8217;re done sending that email.  You could use that channel to send other messages, rather than sending &#8220;QUIT&#8221; if you&#8217;d like.  You might notice that I entered the &#8220;From&#8221; and &#8220;To&#8221; lines twice.  The first entries are for the SMTP header (analogy would be the message envelope), and the second entries are for the MIME headings (analogy would be the return address header in a formal postal letter, if anyone sends those).  The MIME headings are what most mail programs display, and actually don&#8217;t technically need to match the SMTP header (but if MIME and SMTP don&#8217;t match many anti-spam programs will throw out the message).</p>
<p>The MIME header is pretty complex, but not order-dependant, although I prefer to enter it in order, so that I can be sure I don&#8217;t miss anything.<br />
If you want to add an attachment, just base64 encode it first with:<br />
<code>perl -e 'use MIME::Base64; qw(encode_base64); print encode_base64("@ARGV");' cat attachment-to-send.zip</code><br />
Then you can just paste it into the email.  In the MIME heading (right after the subject), just add (with the appropriate mime coding, probably application/octet-string:<br />
<code><br />
------=_NextPart_000_000D_01CC1C41.21F38080<br />
Content-Type: application/zip;<br />
	name="attachment-to-send.zip"<br />
Content-Transfer-Encoding: base64<br />
Content-Disposition: attachment;<br />
	filename="attachment-to-send.zip"<br />
&lt;paste your base64 encoded attachment/ &gt;<br />
Content-Type: multipart/mixed;<br />
	boundary="----=_NextPart_000_000D_01CC1C41.21F38080"<br />
------=_NextPart_000_000D_01CC1C41.21F38080<br />
Content-Type: text/plain;<br />
	charset="us-ascii"<br />
Content-Transfer-Encoding: 7bit</p>
<p>Type your message here, ending with a “.” Standalone on a line.<br />
.</p>
<p></code></p>
<p>Now that you know *how* to send an email message by hand, you can use the returned error codes to troubleshoot where the message may be disappearing.  Remember, that this just gives you transport troubleshooting between yourself and the initial destination mail server.  Many large (and even medium-sized) organizations will have a perimeter mail server which then forwards the message to one or more internal servers.  If the mail is being dropped at that point, you&#8217;ll have to contact the reciever with the proof that their server is accepting your messages.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.totalnetsolutions.net/2011/06/21/howto-test-smtp-by-hand/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>ypcat passwd: No such map passwd.byname. Reason: No such map in server&#8217;s domain</title>
		<link>http://www.totalnetsolutions.net/2011/05/23/ypcat-passwd-no-such-map-passwd-byname-reason-no-such-map-in-servers-domain/</link>
		<comments>http://www.totalnetsolutions.net/2011/05/23/ypcat-passwd-no-such-map-passwd-byname-reason-no-such-map-in-servers-domain/#comments</comments>
		<pubDate>Mon, 23 May 2011 20:19:23 +0000</pubDate>
		<dc:creator>Robert</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Security]]></category>

		<guid isPermaLink="false">http://www.totalnetsolutions.net/?p=78</guid>
		<description><![CDATA[We ran into this bit of fun while setting up a NIS domain for testing in the lab today: rob@rob-kubuntu3:~$ ypcat -d nisdom -h rhel5-64-2 passwd.byname No such map passwd.byname. Reason: No such map in server's domain It turns out this was a problem with the /var/yp/securenets file, but I&#8217;m still not sure what is [...]]]></description>
			<content:encoded><![CDATA[<p>We ran into this bit of fun while setting up a NIS domain for testing in the lab today:<br />
<code>rob@rob-kubuntu3:~$ ypcat -d nisdom -h rhel5-64-2 passwd.byname<br />
No such map passwd.byname. Reason: No such map in server's domain<br />
</code><br />
It turns out this was a problem with the <strong>/var/yp/securenets</strong> file, but I&#8217;m still not sure <strong>what</strong> is wrong.  The man page for ypserv shows:</p>
<blockquote><p>       A sample securenets file might look like this:</p>
<p>              # allow connections from local host &#8212; necessary<br />
              host 127.0.0.1<br />
              # same as 255.255.255.255 127.0.0.1<br />
              #<br />
              # allow connections from any host<br />
              # on the 131.234.223.0 network<br />
              255.255.255.0   131.234.223.0
</p></blockquote>
<p>So we set up our securenets to look like this:</p>
<blockquote><p>
host 127.0.0.1<br />
255.255.255.0 10.10.10.0
</p></blockquote>
<p>And tried to connect to the server:<code><br />
rob@rob-kubuntu3:~$ ip addr show dev wlan0 |grep "inet "<br />
    inet 10.10.10.210/24 brd 10.10.10.255 scope global wlan0<br />
rob@rob-kubuntu3:~$ ypcat -d nisdom -h rhel5-64-2 passwd.byname<br />
No such map passwd.byname. Reason: No such map in server's domain<br />
rob@rob-kubuntu3:~$ ping -c1 rhel5-64-2<br />
PING rhel5-64-2 (10.10.10.213) 56(84) bytes of data.<br />
64 bytes from rhel5-64-2 (10.10.10.213): icmp_req=1 ttl=64 time=0.823 ms</p>
<p>--- rhel5-64-2 ping statistics ---<br />
1 packets transmitted, 1 received, 0% packet loss, time 0ms<br />
rtt min/avg/max/mdev = 0.823/0.823/0.823/0.000 ms</code></p>
<p>Removing the /var/yp/securenets file allowed us access, so it wasn&#8217;t firewall or rpc or portmap issues, to the best I can determine.  Adding &#8220;host 10.10.10.210&#8243; also worked and allowed the client access.  So what&#8217;s wrong with the format / man page?</p>
]]></content:encoded>
			<wfw:commentRss>http://www.totalnetsolutions.net/2011/05/23/ypcat-passwd-no-such-map-passwd-byname-reason-no-such-map-in-servers-domain/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>netlogon error 5602 in Windows 2008</title>
		<link>http://www.totalnetsolutions.net/2011/05/16/netlogon-error-5602-in-windows-2008/</link>
		<comments>http://www.totalnetsolutions.net/2011/05/16/netlogon-error-5602-in-windows-2008/#comments</comments>
		<pubDate>Tue, 17 May 2011 02:54:11 +0000</pubDate>
		<dc:creator>Robert</dc:creator>
				<category><![CDATA[Domain Controllers]]></category>
		<category><![CDATA[Windows]]></category>

		<guid isPermaLink="false">http://www.totalnetsolutions.net/?p=75</guid>
		<description><![CDATA[I upgraded the TNS lab this past week from Windows 2008 to Windows 2008 R2, including replacing the 4 Domain Controllers (rather than upgrading). It gave me a chance to review the procedure for moving a Certificate Server to a new system, which I hadn&#8217;t done since 2005. For those who haven&#8217;t tried, the procedure [...]]]></description>
			<content:encoded><![CDATA[<p>I upgraded the TNS lab this past week from Windows 2008 to Windows 2008 R2, including replacing the 4 Domain Controllers (rather than upgrading).  It gave me a chance to review the procedure for moving a Certificate Server to a new system, which I hadn&#8217;t done since 2005.  For those who haven&#8217;t tried, the procedure for moving a Certificate Server is reasonably well documented at the Microsoft Support site here: <a HREF="http://support.microsoft.com/kb/555012" target="_blank">http://support.microsoft.com/kb/555012</a>.  The part of this that&#8217;s especially tricky, especially in our lab, is the renaming of the DC.</p>
<p>In our lab we have an empty forest root, as per the old (Windows 2000-era) Microsoft recommendations, to match several large customer environments.  Because it&#8217;s a lab, and no clients connect to it, we only have a single DC. I snapshotted it as a backup, and went through the procedure to rename a domain controller, also well documented by Microsoft, this time at <a href="http://technet.microsoft.com/en-us/library/cc782761%28WS.10%29.aspx" target="_blank">TechNet</a>.</p>
<p>For review, the procedure we planned to run was:<br />
<code>netdom computername <strong>dc04</strong> /add:<strong>dc01.lwtest.corp</strong><br />
netdom computername <strong>dc04</strong> /makeprimary:<strong>dc01.lwtest.corp</strong><br />
shutdown -r -t 0<br />
netdom computername <strong>dc01</strong> /enum<br />
netdom computername <strong>dc01</strong> /verify<br />
netdom computername <strong>dc01</strong> /rem:<strong>dc04.lwtest.corp</strong></code></p>
<p>I&#8217;m still not sure what caused it, but in this case, this command failed:<br />
<code>netdom computername <strong>dc04</strong> /makeprimary:<strong>dc01.tns.lab</strong></code><br />
At this point, I couldn&#8217;t make the old name primary again (I would get an &#8220;Access Denied&#8221; error), so I rebooted to see which name had taken.  And that&#8217;s where things went bad.</p>
<p>When the DC came up, we were getting this error: <a href="http://www.totalnetsolutions.net/wp-content/uploads/2011/05/netlogon-event-5602.png"><img src="http://www.totalnetsolutions.net/wp-content/uploads/2011/05/netlogon-event-5602.png" alt="Netlogon EventID 5602" title="netlogon-event-5602" width="628" height="438" class="aligncenter size-full wp-image-77" /></a>. Source: NETLOGON, EventID: 5602, Data: &#8220;An internal error occurred while accessing the computer&#8217;s local or network security database.&#8221;</p>
<p>Because the DC rename hadn&#8217;t completed successfully, the computer couldn&#8217;t actually log into itself to load AD.  Very bad for the root of the forest.  I wasn&#8217;t able to find anything helpful in my searches, so thought I&#8217;d let you know the fix:</p>
<p>Name it back to the old name and try again:<br />
Reboot into Safe Mode.<br />
<code>netdom computername <strong>localhost</strong> /makeprimary:<strong>dc04.lwtest.corp</strong><br />
shutdown -r -t 0</code><br />
Boot normally<br />
<code>netdom computername <strong>localhost</strong> /makeprimary:<strong>dc04.lwtest.corp</strong><br />
netdom computername <strong>dc01</strong> /enum<br />
netdom computername <strong>dc01</strong> /verify<br />
shutdown -r -t 0</code><br />
After *that* reboot, make sure, with the verify command, that the old name took, and that you can log in, and just try the rename again.</p>
<p>I couldn&#8217;t get the &#8220;rename back&#8221; to take untill after the attempt in safe mode. Strange, but it&#8217;s working great now!  Hopefully this will help someone.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.totalnetsolutions.net/2011/05/16/netlogon-error-5602-in-windows-2008/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Retaining mid-pipeline exit status</title>
		<link>http://www.totalnetsolutions.net/2011/02/10/retaining-mid-pipeline-exit-status/</link>
		<comments>http://www.totalnetsolutions.net/2011/02/10/retaining-mid-pipeline-exit-status/#comments</comments>
		<pubDate>Thu, 10 Feb 2011 18:40:03 +0000</pubDate>
		<dc:creator>Robert</dc:creator>
				<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://www.totalnetsolutions.net/?p=47</guid>
		<description><![CDATA[I had a Bourne Shell (sh) script I needed to capture the exit status of, but it was being run through “tee” to capture a log file, so “$?” always returned the exit status of “tee”, not the script. In a nutshell, it went something like this: #!/bin/sh DO_LOG=$1 LOGNAME="`hostname`.out" if [ "$DO_LOG" -eq "1" [...]]]></description>
			<content:encoded><![CDATA[<p>I had a Bourne Shell (sh) script I needed to capture the exit status of, but it was being run through “tee” to capture a log file, so “$?” always returned the exit status of “tee”, not the script. In a nutshell, it went something like this:<br />
<code>#!/bin/sh<br />
DO_LOG=$1<br />
LOGNAME="`hostname`.out"<br />
if [ "$DO_LOG" -eq "1" ]; then<br />
# Logging is turned on, so relaunch ourself with logging disabled, and tee the output to the logfile<br />
sh $0 0 | tee $LOGNAME<br />
exit $?<br />
fi<br />
#... Do lots of things in the script<br />
exit $ERRORCODE</code></p>
<p>Now, the important thing here is that the script sets very specific error codes (we have 16 defined) based on different error states, so that a tool like HP Opsware can give us different reports based on the exit status. When run with “0″ for no logging, this works great, but it requires the controlling tool to capture logs, and not all do (especially cheap “for” loops in a shell script.)</p>
<p>But when run with logging enabled, all of the fancy error code handling (45 lines of subroutines’ worth) gets lost, because “$!” is equal to the status code of the “tee” command. Bash scripters out there will say “but what about $PIPESTATUS ?” If we could use bash, the code would be:<br />
<code>#!/bin/sh<br />
DO_LOG=$1<br />
LOGNAME="`hostname`.out"<br />
if [ "$DO_LOG" -eq "1" ]; then<br />
# Logging is turned on, so relaunch ourself with logging disabled, and tee the output to the logfile<br />
sh $0 0 | tee $LOGNAME<br />
exit ${PIPESTATUS[0]}<br />
fi<br />
#... Do lots of things in the script<br />
exit $ERRORCODE</code></p>
<p>(Note the single line change in the conditional exit.)</p>
<p>But, I don’t have the luxury of bash (thanks AIX and FreeBSD and Solaris 8), so we needed to get fancy…<br />
<code>#!/bin/sh<br />
DO_LOG=$1<br />
LOGNAME="`hostname`.out"<br />
if [ "$DO_LOG" -eq "1" ]; then<br />
# Logging is turned on, so relaunch ourself with logging disabled, and tee the output to the logfile<br />
cp /dev/null $LOGNAME<br />
tail -f $LOGNAME &#038;<br />
TAILPID=$!<br />
sh $0 0 >> $LOGNAME 2>&#038;1<br />
RETURNCODE=$?<br />
kill TAILPID<br />
exit $RETURNCODE<br />
fi<br />
#... Do lots of things in the script<br />
exit $ERRORCODE</code></p>
<p>In this last example, we’re creating the empty logfile by copying /dev/null to the logname, then starting a backgrounded “tail” command on the empty file. Because we haven’t disconnected STDOUT in the backgrounding, we will still get the screen output we desire from “tail”. The script now only writes *its* output, with redirected STDOUT and STDERR, to the log file, which is already being tailed to the actual screen. At the end of the script, we capture the true exit code, clean up the tail ugliness, and exit with the desired status code.</p>
<p>This does have a serious downside that if the script encounters and error and exits, the “tail” is left running indefinitely on Linux and Solaris, since the kernel there will simply scavenge the process to be owned by init. So, if you take this method, be very careful to capture all errors you may possibly encounter. Or, just use a better scripting tool. <img src='http://www.totalnetsolutions.net/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  </p>
]]></content:encoded>
			<wfw:commentRss>http://www.totalnetsolutions.net/2011/02/10/retaining-mid-pipeline-exit-status/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Waiting for good RAM</title>
		<link>http://www.totalnetsolutions.net/2010/11/27/waiting-for-good-ram/</link>
		<comments>http://www.totalnetsolutions.net/2010/11/27/waiting-for-good-ram/#comments</comments>
		<pubDate>Sat, 27 Nov 2010 18:38:16 +0000</pubDate>
		<dc:creator>Robert</dc:creator>
				<category><![CDATA[VMWare]]></category>

		<guid isPermaLink="false">http://www.totalnetsolutions.net/?p=46</guid>
		<description><![CDATA[I have recently pushed the main ESX host for TNS to 70% overcommit on RAM, since upgrading to 4.1. Interestingly (expectedly), the performance now is the same as it was on 3.5 with 2 fewer VMs and only 50% overcommit. But, it’s still pretty poor in the “Lab” performance pool, even after changing that pool [...]]]></description>
			<content:encoded><![CDATA[<p>I have recently pushed the main ESX host for TNS to 70% overcommit on RAM, since upgrading to 4.1. Interestingly (expectedly), the performance now is the same as it was on 3.5 with 2 fewer VMs and only 50% overcommit. But, it’s still pretty poor in the “Lab” performance pool, even after changing that pool from “low” to “normal” shares. So we finally ordered new memory, doubling the server to 16gb. It goes in Sunday night, so we’ll see how things perform next week when Rob’s on site with customers.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.totalnetsolutions.net/2010/11/27/waiting-for-good-ram/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>K9Mail Hosted Exchange ActiveSync Errors Solved</title>
		<link>http://www.totalnetsolutions.net/2010/07/10/k9mail-hosted-exchange-activesync-errors-solved/</link>
		<comments>http://www.totalnetsolutions.net/2010/07/10/k9mail-hosted-exchange-activesync-errors-solved/#comments</comments>
		<pubDate>Sat, 10 Jul 2010 18:43:36 +0000</pubDate>
		<dc:creator>Robert</dc:creator>
				<category><![CDATA[Exchange]]></category>
		<category><![CDATA[Open Source Software]]></category>
		<category><![CDATA[Phones]]></category>

		<guid isPermaLink="false">http://www.totalnetsolutions.net/?p=49</guid>
		<description><![CDATA[I’ve been fighting K9Mail for weeks now, trying to get it to sync with MailStreet who hosts “exchange.ms”) hosted Exchange. If you’ve already followed the instructions at the K9Mail Wiki with no success, read on. Thanks to the k9mail wiki on debugging connection issues and the fact that I already had the Android SDK installed, [...]]]></description>
			<content:encoded><![CDATA[<p>I’ve been fighting K9Mail for weeks now, trying to get it to sync with <a href="http://www.mailstreet.com">MailStreet</a> who hosts “exchange.ms”) hosted Exchange. If you’ve already followed the instructions at the <a href="https://code.google.com/p/k9mail/wiki/K9MailAndExchange">K9Mail Wiki</a> with no success, read on.</p>
<p>Thanks to the k9mail wiki on <a href="https://code.google.com/p/k9mail/wiki/LoggingErrors">debugging connection issues</a> and the fact that I already had the Android SDK installed, I was able to solve the 2 related errors I was getting. I would either get an “HTTP 404 not found” or an “HTTP 501 Not Implemented” depending on the settings I chose. With no additional settings other than suggested in the Wiki, I’d get a “501 not implemented”. If I tried to set a mailbox path, or a WebDAV path, I’d get the HTTP 404 Not Found.</p>
<p>In the debugging log, I saw that the system was calling “http://mail.$domain.exchange.ms/”$webDAVpath/Inbox – if I set it to a full URL, the full URL was getting appended. When I attempted to hit those same paths in a full browser, I’d always get an HTTP 404. So, digging in my history in Firefox, I found the following (cleaned) path:</p>
<p>http://mail.$domain.exchange.ms/exchange/$emailaddress/</p>
<p>In this case $emailaddress was my Exchange mail address with the “@” stripped out. Appending “Inbox” to the end of this path resulted in a valid load of my OWA inbox.</p>
<p>Plugging then: /exchange/$emailaddress/ into the WebDAV box in K9Mail, and my email immediately loaded up.</p>
<p>Now I have Android syncing my calendars and contacts, and k9mail is handling my massive inbox!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.totalnetsolutions.net/2010/07/10/k9mail-hosted-exchange-activesync-errors-solved/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Upgraded WordPress</title>
		<link>http://www.totalnetsolutions.net/2009/09/07/upgraded-wordpress/</link>
		<comments>http://www.totalnetsolutions.net/2009/09/07/upgraded-wordpress/#comments</comments>
		<pubDate>Mon, 07 Sep 2009 18:50:12 +0000</pubDate>
		<dc:creator>Robert</dc:creator>
				<category><![CDATA[Business]]></category>
		<category><![CDATA[Security]]></category>

		<guid isPermaLink="false">http://www.totalnetsolutions.net/?p=51</guid>
		<description><![CDATA[Upgrading software – always required to keep things secure. Windows, WordPress, Mac OSx, Linux, Office, Firefox, etc. So I just finished upgrading TotalNetSolutions.net again. Hopefully I’ll be able to be better about this, now that WordPress does the automatic upgrades now. I’ve been doing the automatic upgrades on one of my other sites since they [...]]]></description>
			<content:encoded><![CDATA[<p>Upgrading software – always required to keep things secure.  Windows, WordPress, Mac OSx, Linux, Office, Firefox, etc.  So I just finished upgrading TotalNetSolutions.net again.  Hopefully I’ll be able to be better about this, now that WordPress does the automatic upgrades now.</p>
<p>I’ve been doing the automatic upgrades on one of my other sites since they came out.  They’re easy, fast, and even more painless than the <a href="http://codex.wordpress.org/Upgrading_WordPress">3-step upgrade</a> that works so well. So now, I should be able to keep TNS much further away from the “cobbler’s kids” syndrome so many small company’s systems suffer with.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.totalnetsolutions.net/2009/09/07/upgraded-wordpress/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

