<?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>LosByers- Interesting Musings Helpful Hints from a Unix System Administrator &#187; Unix</title>
	<atom:link href="http://losbyers.com/wordpress/tag/unix/feed/" rel="self" type="application/rss+xml" />
	<link>http://losbyers.com/wordpress</link>
	<description>All the info I need</description>
	<lastBuildDate>Fri, 10 Sep 2010 04:56:38 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>How-to Add in Apache modules, ie mod_rewrite</title>
		<link>http://losbyers.com/wordpress/2009/12/how-to-add-in-apache-modules-ie-mod_rewrite/</link>
		<comments>http://losbyers.com/wordpress/2009/12/how-to-add-in-apache-modules-ie-mod_rewrite/#comments</comments>
		<pubDate>Mon, 28 Dec 2009 22:08:05 +0000</pubDate>
		<dc:creator>LosByers</dc:creator>
				<category><![CDATA[Web Related]]></category>
		<category><![CDATA[internet]]></category>
		<category><![CDATA[Unix]]></category>
		<category><![CDATA[Web]]></category>

		<guid isPermaLink="false">http://losbyers.com/wordpress/?p=77</guid>
		<description><![CDATA[<p>I seem to need this information often enough so I thought I would post it here for safe keeping.</p>
<p>In Apache 2, shared modules must be compiled with the directive:
&#8211;enable-mods-shared=&#8217;rewrite&#8217;</p>
<p>Multiple modules can be configured that way like so:
&#8211;enable-mods-shared=&#8217;rewrite dav dav-fs&#8217;</p>
<p>A simple config string would look like this:
./configure &#8211;prefix=/usr/local/apache &#8211;enable-mods-shared=&#8217;rewrite&#8217;</p>
<p># EVEN if you screwed up and failed [...]]]></description>
			<content:encoded><![CDATA[<p><span>I seem to need this information often enough so I thought I would post it here for safe keeping.</p>
<p>In Apache 2, shared modules must be compiled with the directive:<br />
&#8211;enable-mods-shared=&#8217;rewrite&#8217;</p>
<p>Multiple modules can be configured that way like so:<br />
&#8211;enable-mods-shared=&#8217;rewrite dav dav-fs&#8217;</p>
<p>A simple config string would look like this:<br />
./configure &#8211;prefix=/usr/local/apache &#8211;enable-mods-shared=&#8217;rewrite&#8217;</p>
<p># EVEN if you screwed up and failed to compile it, by using the horribly broken and often incorrectly documented &#8216;&#8211;enable-rewrite&#8217; switch (which DOES NOT WORK: even ./configure &#8211;help and the apache install docs includes this BS compile directive that DOES NOT WORK), ALL IS NOT LOST. You can still compile any modules by changing to the apache source dir and then the sub directories /modules/mappers (for example: /path/to/your/httpd-source/modules/mappers ) and executing the following command:</p>
<p>/usr/local/apache/bin/apxs -cia mod_rewrite.c</p>
<p># This will compile the modules as a &#8220;so&#8221; or &#8220;shared object&#8221;, and add the proper enabling string to your httpd.conf file: LoadModule rewrite_module modules/mod_rewrite.so</p>
<p>The apxs method of compiling in a module should work for most of the modules you may need.  For instance mod_speling is very useful in dealing with mod_rewrite as it is used to ignore case.</p>
<p>I also just thought that I could download the latest XAMPP version from <a href="http://www.apachefriends.org/" target="_blank">www.apachefriends.org</a> and get the modules I need from there.  It may or may not work.</span></p>
<a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save?linkurl=http%3A%2F%2Flosbyers.com%2Fwordpress%2F2009%2F12%2Fhow-to-add-in-apache-modules-ie-mod_rewrite%2F&amp;linkname=How-to%20Add%20in%20Apache%20modules%2C%20ie%20mod_rewrite"><img src="http://losbyers.com/wordpress/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share/Bookmark"/></a>]]></content:encoded>
			<wfw:commentRss>http://losbyers.com/wordpress/2009/12/how-to-add-in-apache-modules-ie-mod_rewrite/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Sync Web Servers Script</title>
		<link>http://losbyers.com/wordpress/2009/12/sync-web-servers-script/</link>
		<comments>http://losbyers.com/wordpress/2009/12/sync-web-servers-script/#comments</comments>
		<pubDate>Mon, 28 Dec 2009 17:41:30 +0000</pubDate>
		<dc:creator>LosByers</dc:creator>
				<category><![CDATA[Unix]]></category>
		<category><![CDATA[Web Related]]></category>
		<category><![CDATA[internet]]></category>
		<category><![CDATA[scripting]]></category>
		<category><![CDATA[Web]]></category>

		<guid isPermaLink="false">http://losbyers.com/wordpress/?p=74</guid>
		<description><![CDATA[<p>Here is a script I wrote to keep 2 or more web sites in sync.  The data files can be anything under the data tree.
The database is MySQL.</p>
<p>The script works by pulling the latest data and database backup from the production server.  The script can be placed in a cron.
The DR server user should be [...]]]></description>
			<content:encoded><![CDATA[<p>Here is a script I wrote to keep 2 or more web sites in sync.  The data files can be anything under the data tree.<br />
The database is MySQL.</p>
<p>The script works by pulling the latest data and database backup from the production server.  The script can be placed in a cron.<br />
The DR server user should be able to ssh without a password to the production server.  This is accomplished using RSA keys under SSH.</p>
<p>Once both the web site and database are setup, this script pulls the newest files, and latest mysql database backup via rsync.</p>
<p>Change the First set of VARIABLES, and &lt;usernames&gt; and &lt;pathing&gt; where needed.</p>
<p>I should probably have more information on the script here, but I wanted to save a copy somewhere before I forgot about it.</p>
<p>Anyway, my thought is if I setup a primary web server somewhere and want n+1 backend systems I might be able to use this poor-man&#8217;s approach.  If the backed systems need to have database updates then you are looking at database replication.  But, the rsync file copy and all of the rest could be used to make web server production updates to a cluster of systems.  You just update the main instance and all of the slave servers pull the latest information, including a database update script if needed., unix, script</p>
<p><span id="more-74"></span><span style="color: #99cc00;">#!/bin/ksh -x</p>
<p>#######################################<br />
#<br />
# Script to sync Prod web with DR server.<br />
# The script is designed to pull from the<br />
# production server.<br />
#<br />
# 12/2008:  Initial setup.<br />
#        :  Mike Byers<br />
#######################################</p>
<p>PRIME_HOST=&#8217;prod.edmz.com&#8217;                  #Production host<br />
DR_HOST=&#8217;dr-orprod2.edmz.com&#8217;              #DR server<br />
DATABASES=&#8221;mysql DB1 DB2&#8243;                  #database to transfer space sepa<br />
rated<br />
#MYSQLUSER=backup                               #User for database backup<br />
MYSQLUSER=restore                                  #User for database restore<br />
#MYSQLPWD=&#8217;ABC123&#8242;                             #Backup user Password<br />
MYSQLPWD=&#8217;ABC123&#8242;                               #Restore user Password (Restore user needs more DB permissions)<br />
DB_PATH=&#8217;/opt/mysql5/backups&#8217;                 #Path to database backup files<br />
#YESTERDAY=`date +%Y%m%d -d&#8221;1 day ago&#8221;`         #Linux Version<br />
YESTERDAY=`TZ=GMT+24 date +%Y%m%d`              #Solaris Version<br />
TODAY=`date +%Y%m%d`<br />
PATH=$PATH:/opt/mysql5/bin/;export PATH  #Path to mysql binaries</p>
<p>/usr/bin/rsync &#8211;exclude &#8216;configuration.*&#8217; \<br />
&#8211;exclude &#8216;**/logs&#8217; \<br />
&#8211;exclude &#8216;**/modules&#8217; \<br />
&#8211;exclude &#8216;**/conf&#8217; \<br />
&#8211;exclude &#8216;**/bin&#8217; \<br />
-vaue &#8217;ssh -x -C -l &lt;username&gt;&#8217; $PRIME_HOST:apache/htdocs/* /&lt;path&gt;/apache/htdocs/</p>
<p>for DB in $DATABASES<br />
do<br />
/usr/bin/rsync -vaue &#8217;ssh -x -C -l &lt;username&gt;&#8217; $PRIME_HOST:$DB_PATH/$DB-$TODAY.sql.<br />
gz $DB_PATH<br />
#Compare sizes of database backup files to see if anything changed<br />
S1=`du -sk $DB_PATH/$DB-$YESTERDAY.sql.gz | awk &#8216;{ print $1 }&#8217;`<br />
S2=`du -sk $DB_PATH/$DB-$TODAY.sql.gz | awk &#8216;{ print $1 }&#8217;`<br />
if [[ S1 -eq S2 ]]; then<br />
echo &#8220;No update for database $DB needed&#8221;<br />
else<br />
/bin/gunzip &lt; $DB_PATH/$DB-$TODAY.sql.gz | mysql -u $MYSQLUSER -p$MYSQLPWD<br />
$DB<br />
fi<br />
done</span></p>
<a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save?linkurl=http%3A%2F%2Flosbyers.com%2Fwordpress%2F2009%2F12%2Fsync-web-servers-script%2F&amp;linkname=Sync%20Web%20Servers%20Script"><img src="http://losbyers.com/wordpress/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share/Bookmark"/></a>]]></content:encoded>
			<wfw:commentRss>http://losbyers.com/wordpress/2009/12/sync-web-servers-script/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Funny Unix commands</title>
		<link>http://losbyers.com/wordpress/2009/12/funny-unix-commands/</link>
		<comments>http://losbyers.com/wordpress/2009/12/funny-unix-commands/#comments</comments>
		<pubDate>Mon, 28 Dec 2009 17:34:36 +0000</pubDate>
		<dc:creator>LosByers</dc:creator>
				<category><![CDATA[Humor]]></category>
		<category><![CDATA[Unix]]></category>

		<guid isPermaLink="false">http://losbyers.com/wordpress/?p=70</guid>
		<description><![CDATA[<p>Handy command for those users that are most annoying.</p>
<p># fuser -uck /you </p>
<p>Find all the processes running under the mount point /you and kill them all ungracefully.</p>
<p>About as much fun to read as</p>
<p># sort -n ass &#124; uniq -c</p>
<p>Unix can tell you all.</p>
<p>Login and type /bin/csh then type the following questions.</p>
<p>% &#8220;How would you rate [...]]]></description>
			<content:encoded><![CDATA[<p><span>Handy command for those users that are most annoying.</span></p>
<p><strong># fuser -uck /you </strong></p>
<p>Find all the processes running under the mount point /you and kill them all ungracefully.</p>
<p>About as much fun to read as</p>
<p><strong># sort -n ass | uniq -c</strong></p>
<p><span>Unix can tell you all.</p>
<p>Login and type /bin/csh then type the following questions.</p>
<p><strong>% &#8220;How would you rate Bush&#8217;s stupidity? </strong><br />
&gt; Unmatched &#8221;</p>
<p><strong>% [But Where is his brain? </strong><br />
&gt; Missing ]</p>
<p><strong>% man: Why can they stop this war? </strong><br />
&gt; man:: Too many arguments</span></p>
<a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save?linkurl=http%3A%2F%2Flosbyers.com%2Fwordpress%2F2009%2F12%2Ffunny-unix-commands%2F&amp;linkname=Funny%20Unix%20commands"><img src="http://losbyers.com/wordpress/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share/Bookmark"/></a>]]></content:encoded>
			<wfw:commentRss>http://losbyers.com/wordpress/2009/12/funny-unix-commands/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Helpful Unix commands</title>
		<link>http://losbyers.com/wordpress/2009/12/helpful-unix-commands/</link>
		<comments>http://losbyers.com/wordpress/2009/12/helpful-unix-commands/#comments</comments>
		<pubDate>Mon, 28 Dec 2009 17:32:10 +0000</pubDate>
		<dc:creator>LosByers</dc:creator>
				<category><![CDATA[Unix]]></category>
		<category><![CDATA[KSH]]></category>
		<category><![CDATA[scripting]]></category>

		<guid isPermaLink="false">http://losbyers.com/wordpress/?p=68</guid>
		<description><![CDATA[<p>A thread dedicated to those useful Unix commands we all know and love.  Ya right. </p>
<p>I need a really tricky find command the other day so I came up with the following.  I wanted to save the command some where as it really shows the power of find</p>
<p>Find all files that are not in the [...]]]></description>
			<content:encoded><![CDATA[<p><span>A thread dedicated to those useful Unix commands we all know and love.  Ya right. <img title="Shocked" src="http://www.losbyers.com/modules/Forums/images/smiles/icon_eek.gif" border="0" alt="Shocked" /></p>
<p>I need a really tricky <span style="font-style: italic;">find</span> command the other day so I came up with the following.  I wanted to save the command some where as it really shows the power of <span style="font-style: italic;">find</span></p>
<p>Find all files that are not in the images or languages directory that are older than seven days that end with .php or .doc and delete them also leave a log file of what was deleted.</p>
<p><span style="font-weight: bold;"> find ./  \( -name images -o -name languages \) -prune -o \( -name &#8216;*.php&#8217; -o -name &#8216;*.doc&#8217; \) -mtime +7 -exec rm {} \; -print &gt; /var/tmp/deleted_files</span></p>
<p>Sorry the command is all on one line.  Because the <span style="font-style: italic;">find</span> statement is utilizing regular expressions and complex statements, ie &#8220;<span style="font-weight: bold;">\(</span>&#8220;, so you can&#8217;t use the &#8220;\&#8221; and take the statement to the next line.</p>
<p>To read the command better take it one step at a time.<br />
Find all files or directories that have the name &#8220;images&#8221; OR the name &#8220;languages&#8221; and prune/remove those items found from the find results.   Using the -prune option is a great way to setup exclusions.  The next &#8220;-o&#8221; OR says if the files found are not named &#8220;images&#8221; or &#8220;languages&#8221; find the files that end in &#8220;.php&#8221; or &#8220;.doc&#8221; that are older than 7 days.  If anything is found that meets the conditions then remove those files and &#8220;print&#8221; the file name out to the log file.</span></p>
<a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save?linkurl=http%3A%2F%2Flosbyers.com%2Fwordpress%2F2009%2F12%2Fhelpful-unix-commands%2F&amp;linkname=Helpful%20Unix%20commands"><img src="http://losbyers.com/wordpress/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share/Bookmark"/></a>]]></content:encoded>
			<wfw:commentRss>http://losbyers.com/wordpress/2009/12/helpful-unix-commands/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Pass a Shell variable to a SED command</title>
		<link>http://losbyers.com/wordpress/2009/12/pass-a-shell-variable-to-a-sed-command/</link>
		<comments>http://losbyers.com/wordpress/2009/12/pass-a-shell-variable-to-a-sed-command/#comments</comments>
		<pubDate>Mon, 28 Dec 2009 17:29:40 +0000</pubDate>
		<dc:creator>LosByers</dc:creator>
				<category><![CDATA[Unix]]></category>
		<category><![CDATA[KSH]]></category>
		<category><![CDATA[scripting]]></category>

		<guid isPermaLink="false">http://losbyers.com/wordpress/?p=65</guid>
		<description><![CDATA[<p>I just helped a friend out with placing a shell variable into a sed command and thought it would be prudent to document it.</p>
<p>This set of commands was to be used to change directory names inside a samba share, hense the directory names of \ and the unix escape needed making a bunch of \\ [...]]]></description>
			<content:encoded><![CDATA[<p><span>I just helped a friend out with placing a shell variable into a sed command and thought it would be prudent to document it.</p>
<p>This set of commands was to be used to change directory names inside a samba share, hense the directory names of \ and the unix escape needed making a bunch of \\ appear.</p>
<p>server_name#  <strong>DIR=&#8221;blahblah&#8221; </strong><br />
server_name#  <strong>echo &#8220;bob&#8221; | sed &#8220;s/^/${DIR}\\\ADMIND__${DIR}\\\/&#8221; </strong><br />
<span style="font-weight: bold;">blahblah\ADMIND__blahblah\bob</span><br />
</span></p>
<p><span><br />
Set the variable DIR to &#8220;blahblah&#8221;, I should have just used &#8220;foo&#8221; it&#8217;s less to type.  Now echo the word &#8220;bob&#8221; but first add our variable and a prefix of &#8220;ADMIND__&#8221; to the front of bob.<br />
</span></p>
<p><span>I wanted to show another example, but don&#8217;t have time at the momment.</p>
<p>The important things to remember is to have the variables enclosed in double quotes.</span></p>
<a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save?linkurl=http%3A%2F%2Flosbyers.com%2Fwordpress%2F2009%2F12%2Fpass-a-shell-variable-to-a-sed-command%2F&amp;linkname=Pass%20a%20Shell%20variable%20to%20a%20SED%20command"><img src="http://losbyers.com/wordpress/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share/Bookmark"/></a>]]></content:encoded>
			<wfw:commentRss>http://losbyers.com/wordpress/2009/12/pass-a-shell-variable-to-a-sed-command/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Overcoming the dreaded SCP/SFTP message errors</title>
		<link>http://losbyers.com/wordpress/2009/12/overcoming-the-dreaded-scpsftp-message-errors/</link>
		<comments>http://losbyers.com/wordpress/2009/12/overcoming-the-dreaded-scpsftp-message-errors/#comments</comments>
		<pubDate>Mon, 28 Dec 2009 17:23:37 +0000</pubDate>
		<dc:creator>LosByers</dc:creator>
				<category><![CDATA[Unix]]></category>
		<category><![CDATA[Web Related]]></category>
		<category><![CDATA[internet]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[Web]]></category>

		<guid isPermaLink="false">http://losbyers.com/wordpress/?p=62</guid>
		<description><![CDATA[<p>If you have ever used scp or sftp you may have encountered the dreaded ( &#8221;Received message too long&#8221; or &#8220;Bad packet length&#8221; &#8221;) errors.</p>
<p>This is typically due to something being echo&#8217;d or sent back to your login attempt.</p>
<p>Usually, it&#8217;s something you have in your .profile or .bashrc login files.</p>
<p>Just add the following to the [...]]]></description>
			<content:encoded><![CDATA[<p><span>If you have ever used scp or sftp you may have encountered the dreaded ( &#8221;Received message too long&#8221; or &#8220;Bad packet length&#8221; &#8221;) errors.</p>
<p>This is typically due to something being echo&#8217;d or sent back to your login attempt.</p>
<p>Usually, it&#8217;s something you have in your .profile or .bashrc login files.</p>
<p>Just add the following to the very top of your login shell settings file.</p>
<p><strong><span style="font-weight: bold;">if [ ${TERM} == "dumb" ]; then<br />
return<br />
fi</span></strong></p>
<p>This will exit out of running the login shell commands if you login using a &#8220;dumb&#8221; terminal.</span></p>
<a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save?linkurl=http%3A%2F%2Flosbyers.com%2Fwordpress%2F2009%2F12%2Fovercoming-the-dreaded-scpsftp-message-errors%2F&amp;linkname=Overcoming%20the%20dreaded%20SCP%2FSFTP%20message%20errors"><img src="http://losbyers.com/wordpress/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share/Bookmark"/></a>]]></content:encoded>
			<wfw:commentRss>http://losbyers.com/wordpress/2009/12/overcoming-the-dreaded-scpsftp-message-errors/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Procedure to swap ZFS pools Solaris</title>
		<link>http://losbyers.com/wordpress/2009/12/procedure-to-swap-zfs-pools-solaris/</link>
		<comments>http://losbyers.com/wordpress/2009/12/procedure-to-swap-zfs-pools-solaris/#comments</comments>
		<pubDate>Tue, 22 Dec 2009 22:21:37 +0000</pubDate>
		<dc:creator>LosByers</dc:creator>
				<category><![CDATA[Unix]]></category>
		<category><![CDATA[Solaris]]></category>

		<guid isPermaLink="false">http://losbyers.com/wordpress/?p=52</guid>
		<description><![CDATA[<p>Procedure to add a new ZFS pool to a system, copy the data from an old pool, switch the mounts and remove the old pool.</p>
<p>Sorry there isn&#8217;t much in the way of comments or coloring.  It was just copied from the terminal window.  The procedure below does create the ZFS filesystem, clone it, move it, [...]]]></description>
			<content:encoded><![CDATA[<p><span>Procedure to add a new ZFS pool to a system, copy the data from an old pool, switch the mounts and remove the old pool.</span></p>
<p>Sorry there isn&#8217;t much in the way of comments or coloring.  It was just copied from the terminal window.  The procedure below does create the ZFS filesystem, clone it, move it, then deletes the old ZFS information.</p>
<p>The procedure uses disks mapped from and EMC array.  The reason it was needed is that a new EMC was introduced so the data needed to be copied from the old EMC to the new EMC disks, and the old EMC disks needed to be disconnected.</p>
<p>The procedure will walk through creating a volume, adding data to it, cloning it, swapping volumes, and deleting the original.</p>
<p><span id="more-52"></span></p>
<p><span> nj11mhf0016$ sudo zpool create -f -m /testa testz1 emcpower1a<br />
nj11mhf0016$ sudo zpool create -f -m /testb testz2 emcpower2a<br />
</span></p>
<p><span>nj11mhf0016$ zpool list<br />
NAME                    SIZE    USED   AVAIL    CAP  HEALTH     ALTROOT<br />
testz1                  101G     94K    101G     0%  ONLINE     -<br />
testz2                  101G     94K    101G     0%  ONLINE     -<br />
</span></p>
<p><span>nj11mhf0016$ df -k<br />
Filesystem            kbytes    used   avail capacity  Mounted on<br />
/dev/dsk/c0t0d0s0    108126717 6000499 101044951     6%    /<br />
/devices                   0       0       0     0%    /devices<br />
ctfs                       0       0       0     0%    /system/contract<br />
proc                       0       0       0     0%    /proc<br />
mnttab                     0       0       0     0%    /etc/mnttab<br />
swap                 61207120    1024 61206096     1%    /etc/svc/volatile<br />
objfs                      0       0       0     0%    /system/object<br />
fd                         0       0       0     0%    /dev/fd<br />
swap                 61206096       0 61206096     0%    /tmp<br />
swap                 61206152      56 61206096     1%    /var/run<br />
testz1               104251392      24 104251301     1%    /testa<br />
testz2               104251392      24 104251301     1%    /testb<br />
</span></p>
<p><span>nj11mhf0016$ sudo zfs create -o quota=24G testz1/data<br />
nj11mhf0016$ sudo zfs create -o quota=24G testz2/data<br />
</span></p>
<p><span>nj11mhf0016$ df -k<br />
Filesystem            kbytes    used   avail capacity  Mounted on<br />
/dev/dsk/c0t0d0s0    108126717 6000499 101044951     6%    /<br />
/devices                   0       0       0     0%    /devices<br />
ctfs                       0       0       0     0%    /system/contract<br />
proc                       0       0       0     0%    /proc<br />
mnttab                     0       0       0     0%    /etc/mnttab<br />
swap                 61207072    1024 61206048     1%    /etc/svc/volatile<br />
objfs                      0       0       0     0%    /system/object<br />
fd                         0       0       0     0%    /dev/fd<br />
swap                 61206048       0 61206048     0%    /tmp<br />
swap                 61206104      56 61206048     1%    /var/run<br />
testz1               104251392      25 104251271     1%    /testa<br />
testz2               104251392      24 104251272     1%    /testb<br />
testz1/data          25165824      24 25165799     1%    /testa/data<br />
testz2/data          25165824      24 25165799     1%    /testb/data</span></p>
<p># Copy in some data for testing<br />
sudo rsync -qa -H /var /testa/data/</p>
<p># Make a few test changes and copy the data to the 2nd mount point.<br />
sudo rsync -qa -H /testa/data/* /testb/data/</p>
<p>nj11mhf0016$ df -k<br />
Filesystem            kbytes    used   avail capacity  Mounted on<br />
/dev/dsk/c0t0d0s0    108126717 6000548 101044902     6%    /<br />
/devices                   0       0       0     0%    /devices<br />
ctfs                       0       0       0     0%    /system/contract<br />
proc                       0       0       0     0%    /proc<br />
mnttab                     0       0       0     0%    /etc/mnttab<br />
swap                 52008488    1024 52007464     1%    /etc/svc/volatile<br />
objfs                      0       0       0     0%    /system/object<br />
fd                         0       0       0     0%    /dev/fd<br />
swap                 52007464       0 52007464     0%    /tmp<br />
swap                 52007520      56 52007464     1%    /var/run<br />
testz1               104251392      25 99863975     1%    /testa<br />
testz2               104251392      26 99863897     1%    /testb<br />
testz1/data          25165824 4387236 20778587    18%    /testa/data<br />
testz2/data          25165824 4387339 20778485    18%    /testb/data</p>
<p>Now swap and delete them.</p>
<p>Move testa to the side, just in case.<br />
nj11mhf0016$ zfs list<br />
NAME          USED  AVAIL  REFER  MOUNTPOINT<br />
testz1       4.18G  95.2G  25.5K  /testa<br />
testz1/data  4.18G  19.8G  4.18G  /testa/data<br />
testz2       4.18G  95.2G  26.5K  /testb<br />
testz2/data  4.18G  19.8G  4.18G  /testb/data<br />
nj11mhf0016$ sudo mkdir /move<br />
nj11mhf0016$ sudo zfs set mountpoint=/move testz1</p>
<p>nj11mhf0016$ df -k<br />
Filesystem            kbytes    used   avail capacity  Mounted on<br />
/dev/dsk/c0t0d0s0    108126717 6000550 101044900     6%    /<br />
/devices                   0       0       0     0%    /devices<br />
ctfs                       0       0       0     0%    /system/contract<br />
proc                       0       0       0     0%    /proc<br />
mnttab                     0       0       0     0%    /etc/mnttab<br />
swap                 52004096    1024 52003072     1%    /etc/svc/volatile<br />
objfs                      0       0       0     0%    /system/object<br />
fd                         0       0       0     0%    /dev/fd<br />
swap                 52003072       0 52003072     0%    /tmp<br />
swap                 52003128      56 52003072     1%    /var/run<br />
testz2               104251392      26 99863897     1%    /testb<br />
testz2/data          25165824 4387339 20778485    18%    /testb/data<br />
testz1               104251392      25 99863571     1%    /move<br />
testz1/data          25165824 4387627 20778197    18%    /move/data</p>
<p>Move new files onto the old mount.<br />
nj11mhf0016$ sudo zfs set mountpoint=/testa testz2</p>
<p>nj11mhf0016$ df -k<br />
Filesystem            kbytes    used   avail capacity  Mounted on<br />
/dev/dsk/c0t0d0s0    108126717 6000558 101044892     6%    /<br />
/devices                   0       0       0     0%    /devices<br />
ctfs                       0       0       0     0%    /system/contract<br />
proc                       0       0       0     0%    /proc<br />
mnttab                     0       0       0     0%    /etc/mnttab<br />
swap                 51995568    1024 51994544     1%    /etc/svc/volatile<br />
objfs                      0       0       0     0%    /system/object<br />
fd                         0       0       0     0%    /dev/fd<br />
swap                 51994544       0 51994544     0%    /tmp<br />
swap                 51994600      56 51994544     1%    /var/run<br />
testz1               104251392      25 99863571     1%    /move<br />
testz1/data          25165824 4387627 20778197    18%    /move/data<br />
testz2               104251392      26 99863838     1%    /testa<br />
testz2/data          25165824 4387339 20778485    18%    /testa/data</p>
<p># Verify that everything is ok and the same.</p>
<p># Remove the move pool.<br />
nj11mhf0016$ sudo zfs destroy -r testz1<br />
nj11mhf0016$ sudo zpool destroy testz1</p>
<p>nj11mhf0016$ df -k<br />
Filesystem            kbytes    used   avail capacity  Mounted on<br />
/dev/dsk/c0t0d0s0    108126717 6000557 101044893     6%    /<br />
/devices                   0       0       0     0%    /devices<br />
ctfs                       0       0       0     0%    /system/contract<br />
proc                       0       0       0     0%    /proc<br />
mnttab                     0       0       0     0%    /etc/mnttab<br />
swap                 51977088    1024 51976064     1%    /etc/svc/volatile<br />
objfs                      0       0       0     0%    /system/object<br />
fd                         0       0       0     0%    /dev/fd<br />
swap                 51976064       0 51976064     0%    /tmp<br />
swap                 51976120      56 51976064     1%    /var/run<br />
testz2               104251392      26 99863838     1%    /testa<br />
testz2/data          25165824 4387339 20778485    18%    /testa/data</p>
<a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save?linkurl=http%3A%2F%2Flosbyers.com%2Fwordpress%2F2009%2F12%2Fprocedure-to-swap-zfs-pools-solaris%2F&amp;linkname=Procedure%20to%20swap%20ZFS%20pools%20Solaris"><img src="http://losbyers.com/wordpress/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share/Bookmark"/></a>]]></content:encoded>
			<wfw:commentRss>http://losbyers.com/wordpress/2009/12/procedure-to-swap-zfs-pools-solaris/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Find processes and what network ports they use on Solaris 10</title>
		<link>http://losbyers.com/wordpress/2009/12/find-processes-and-what-network-ports-they-use-on-solaris-10/</link>
		<comments>http://losbyers.com/wordpress/2009/12/find-processes-and-what-network-ports-they-use-on-solaris-10/#comments</comments>
		<pubDate>Tue, 22 Dec 2009 22:14:04 +0000</pubDate>
		<dc:creator>LosByers</dc:creator>
				<category><![CDATA[Unix]]></category>
		<category><![CDATA[Solaris]]></category>

		<guid isPermaLink="false">http://losbyers.com/wordpress/?p=48</guid>
		<description><![CDATA[<p>Show all of the processes and any open ports that they may be using.</p>
<p>for pid in `ps -aeo pid &#124; grep -v PID`; do
sudo pfiles ${pid} &#124; egrep &#8220;^${pid}:&#124;sockname:&#8221;
done</p>
<p>Once you know the PID&#8217;s of the processes you can determine all of the atributes of the applications using pargs, instead of ps. In Solaris 10 the [...]]]></description>
			<content:encoded><![CDATA[<p>Show all of the processes and any open ports that they may be using.</p>
<p><span style="color: #800080;">for pid in `ps -aeo pid | grep -v PID`; do<br />
sudo pfiles ${pid} | egrep &#8220;^${pid}:|sockname:&#8221;<br />
done</span></p>
<p>Once you know the PID&#8217;s of the processes you can determine all of the atributes of the applications using pargs, instead of ps. In Solaris 10 the /usr/ucb/ps is the same AT&amp;T version as /bin/ps, so the output is not very handy.</p>
<p><span style="color: #800080;">sudo pargs PID</span></p>
<p>The output for both will look like the following</p>
<p><span style="color: #3366ff;">sudo pfiles 28141 | egrep &#8220;^28141:|sockname:&#8221;<br />
28141:  /local/apps/wlapp02/Autonomy/IDOLServer/jre/bin/java -Djava.util.loggi<br />
sockname: AF_INET 0.0.0.0  port: 8080<br />
sockname: AF_INET 0.0.0.0  port: 50608<br />
sockname: AF_INET 0.0.0.0  port: 8009<br />
sockname: AF_INET 127.0.0.1  port: 8005</span></p>
<p><span style="color: #3366ff;">sudo pargs 28141<br />
28141:  /local/apps/wlapp02/Autonomy/IDOLServer/jre/bin/java -Djava.util.logging.manage<br />
argv[0]: /local/apps/wlapp02/Autonomy/IDOLServer/jre/bin/java<br />
argv[1]: -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager</span></p>
<a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save?linkurl=http%3A%2F%2Flosbyers.com%2Fwordpress%2F2009%2F12%2Ffind-processes-and-what-network-ports-they-use-on-solaris-10%2F&amp;linkname=Find%20processes%20and%20what%20network%20ports%20they%20use%20on%20Solaris%2010"><img src="http://losbyers.com/wordpress/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share/Bookmark"/></a>]]></content:encoded>
			<wfw:commentRss>http://losbyers.com/wordpress/2009/12/find-processes-and-what-network-ports-they-use-on-solaris-10/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Launch Application from Excel</title>
		<link>http://losbyers.com/wordpress/2009/12/launch-application-from-excel/</link>
		<comments>http://losbyers.com/wordpress/2009/12/launch-application-from-excel/#comments</comments>
		<pubDate>Tue, 22 Dec 2009 22:11:33 +0000</pubDate>
		<dc:creator>LosByers</dc:creator>
				<category><![CDATA[Unix]]></category>
		<category><![CDATA[Windows OS]]></category>
		<category><![CDATA[Windows]]></category>

		<guid isPermaLink="false">http://losbyers.com/wordpress/?p=46</guid>
		<description><![CDATA[<p>I started out with the need to be able to launch a putty SSH window from Excel that had a list of hosts and/or IP addresses.</p>
<p>In Microsoft Excel</p>
<p>1) View/Toolbars Visual Basic
2) Click the Control Toolbox icon
3) Click on the Command Button icon and then click in your worksheet or drag the icon symbol.
4) Right click [...]]]></description>
			<content:encoded><![CDATA[<p>I started out with the need to be able to launch a putty SSH window from Excel that had a list of hosts and/or IP addresses.</p>
<p><span>In Microsoft Excel</p>
<p>1) View/Toolbars Visual Basic<br />
2) Click the Control Toolbox icon<br />
3) Click on the Command Button icon and then click in your worksheet or drag the icon symbol.<br />
4) Right click on the button and choose properties.<br />
5) Change the name to PuttyButton<br />
6) Change the Caption to &#8220;Launch Putty&#8221;<br />
7) Double click on the button to bring up the Visual Basic Editor<br />
 <img src='http://losbyers.com/wordpress/wp-includes/images/smilies/icon_cool.gif' alt='8)' class='wp-smiley' /> Make the script look like the following (Make sure the paths are correct for you)<br />
Private Sub PuttyButton_Click()<br />
Shell &#8220;C:\Program Files\putty\putty.exe &#8221; &amp; ActiveCell, vbNormalFocus<br />
End Sub<br />
9) Go to file and choose close and return.<br />
10) Unselect Control Toolbox and Unselect the Design Mode button.<br />
11) Add an IP or hostname to a cell and Click on the Launch Putty Button.</p>
<p>If you have a different login then make the cell read &#8220;-l login 12.9.12.10&#8243; and the button will still work.</span></p>
<a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save?linkurl=http%3A%2F%2Flosbyers.com%2Fwordpress%2F2009%2F12%2Flaunch-application-from-excel%2F&amp;linkname=Launch%20Application%20from%20Excel"><img src="http://losbyers.com/wordpress/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share/Bookmark"/></a>]]></content:encoded>
			<wfw:commentRss>http://losbyers.com/wordpress/2009/12/launch-application-from-excel/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Unix Terminal Headers and Titles</title>
		<link>http://losbyers.com/wordpress/2009/12/unix-terminal-headers-and-titles/</link>
		<comments>http://losbyers.com/wordpress/2009/12/unix-terminal-headers-and-titles/#comments</comments>
		<pubDate>Tue, 22 Dec 2009 22:08:31 +0000</pubDate>
		<dc:creator>LosByers</dc:creator>
				<category><![CDATA[Unix]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[KSH]]></category>

		<guid isPermaLink="false">http://losbyers.com/wordpress/?p=44</guid>
		<description><![CDATA[<p>Please see another post of mine about terminal colors if this post is a little confusing.</p>
<p>Add the following to your .kshrc or .bashrc files.</p>
<p># KSH terminal headers add to .profile
PS1=`uname -n`&#8221; $ &#8221;
alias cd=_cd
function _cd {
\cd ${1+&#8221;$@&#8221;} &#38;&#38; echo &#8220;\033]0;${USER}@${HOST}: ${PWD}\007\c&#8221;
}</p>
<p># BASH terminal headers add to .bashrc
PROMPT_COMMAND=&#8217;echo -ne &#8220;\033]0;${USER}@${HOSTNAME}: ${PWD/$HOME/~}\007&#8243;&#8216;
# PS1=&#8217;\h] \w\$ &#8216; #simple prompt [...]]]></description>
			<content:encoded><![CDATA[<p>Please see another post of mine about <a title="terminal font colors" href="http://losbyers.com/wordpress/2009/12/unix-terminal-font-colors/" target="_blank">terminal colors</a> if this post is a little confusing.</p>
<p>Add the following to your .kshrc or .bashrc files.</p>
<p><span># KSH terminal headers add to .profile<br />
PS1=`uname -n`&#8221; $ &#8221;<br />
alias cd=_cd<br />
function _cd {<br />
\cd ${1+&#8221;$@&#8221;} &amp;&amp; echo &#8220;\033]0;${USER}@${HOST}: ${PWD}\007\c&#8221;<br />
}</span></p>
<p># BASH terminal headers add to .bashrc<br />
PROMPT_COMMAND=&#8217;echo -ne &#8220;\033]0;${USER}@${HOSTNAME}: ${PWD/$HOME/~}\007&#8243;&#8216;<br />
# PS1=&#8217;\h] \w\$ &#8216; #simple prompt with hostname and current path<br />
PS1=&#8217;\[\033[01;32m\]\u@\h \[\033[01;34m\]\W \$ \[\033[00m\]&#8216; #color prompt</p>
<p><span><span id="more-44"></span>More detailed historic type information.</span></p>
<p><span>So you want the title bar to look different in you xterm or terminal window?</span></p>
<p>This also works for Putty terminal windows.</p>
<p><span style="font-weight: bold;">echo -n ^[]1\;$icon_name\^G^[]2\;$HOSTNAME\: $cwd\^G&#8217;</span></p>
<p>Two small changes will be necessary after this text is cut &amp; pasted.<br />
Replace the &#8220;^[" and "^G" characters with esc and CNTL-G by typing [ctrl-v][esc] and [ctrl-v][ctrl-g].</p>
<p>You can set up an alias</p>
<p><span style="font-weight: bold;">alias mytitle &#8216;icon_name; echo -n ^[]1\;$icon_name\^G^[]2\;$HOSTNAME\: $cwd\^G&#8217; </span></p>
<p>Then set an alias to change your prompt and title</p>
<p><span style="font-weight: bold;">alias cd &#8216;chdir \!*;set prompt=&#8221;`dirs`#\\!% &#8220;; mytitle&#8217;</span></p>
<p>Another way of stating this is:<br />
Window and icon titles may be changed in a running xterm by using XTerm escape sequences. The following sequences are useful in this respect:</p>
<p>ESC]0;stringBEL &#8212; Set icon name and window title to string<br />
ESC]1;stringBEL &#8212; Set icon name to string<br />
ESC]2;stringBEL &#8212; Set window title to string<br />
where ESC is the escape character (\033), and BEL is the bell character (\007).</p>
<p><span style="font-weight: bold;"> echo -n &#8220;\033]0;${USER}@${HOST}\007&#8243; </span></p>
<p>should produce a title like username@hostname, assuming the shell variables $USER and $HOST are set correctly.</p>
<p><span>&#8212;-</span></p>
<p><span>I found the following also works very well.</span></p>
<p>Add these lines to your .profile for KSH or .bashrc for BASH and just uncomment the KSH or BASH line.</p>
<p><span style="color: green;">function _cd {<br />
# KSH terminal headers<br />
# \cd ${1+&#8221;$@&#8221;} &amp;&amp; echo &#8220;\033]0;${USER}@${HOST}: ${PWD}\007\c&#8221;<br />
# BASH terminal headers<br />
# \cd ${1+&#8221;$@&#8221;} &amp;&amp; echo -ne &#8220;\033]0;${USER}@${HOST}: ${PWD}\007&#8243;<br />
}</span></p>
<p>alias cd=_cd</p>
<p># Cool Colored prompt for BASH Shells it shows user@host and Present directory, but not the whole PATH.<br />
# PS1=&#8217;\[\033[01;32m\]\u@\h \[\033[01;34m\]\W \$ \[\033[00m\]&#8216;</p>
<p>I also like to add the following to my .bashrc so that I can use VI type commands<br />
set -o vi</p>
<a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save?linkurl=http%3A%2F%2Flosbyers.com%2Fwordpress%2F2009%2F12%2Funix-terminal-headers-and-titles%2F&amp;linkname=Unix%20Terminal%20Headers%20and%20Titles"><img src="http://losbyers.com/wordpress/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share/Bookmark"/></a>]]></content:encoded>
			<wfw:commentRss>http://losbyers.com/wordpress/2009/12/unix-terminal-headers-and-titles/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
