<?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>Silas Sewell - April 2009</title>
        <atom:link href="http://www.silassewell.com/blog/2009/04/rss2.xml" rel="self" type="application/rss+xml" />
        <link>http://www.silassewell.com/blog/2009/04</link>
        <description>Infrastructure Development</description>
        <lastBuildDate>Sat, 08 Jan 2011 00:00:00 GMT</lastBuildDate>
        <generator>http://www.silassewell.com/</generator>
        <language>en</language>
        <sy:updatePeriod>hourly</sy:updatePeriod>
        <sy:updateFrequency>1</sy:updateFrequency>

        <item>
            <title>funcshell — A Shell Interface to Func</title>
            <link>http://www.silassewell.com/blog/2009/04/22/funcshell-a-shell-interface-to-func/</link>
            <pubDate>Wed, 22 Apr 2009 00:00:00 GMT</pubDate>
            <dc:creator>silas</dc:creator>
            <category><![CDATA[Fedora]]></category><category><![CDATA[Func]]></category><category><![CDATA[FuncShell]]></category><category><![CDATA[Programming]]></category><category><![CDATA[Projects]]></category><category><![CDATA[Systems Administration]]></category>
            <guid isPermaLink="true">http://www.silassewell.com/blog/2009/04/22/funcshell-a-shell-interface-to-func/</guid>
            <description><![CDATA[<h3>Features</h3>

<ul>
<li>advanced client selection (you can use + and - to add/remove hosts/groups)</li>
<li>tab completion</li>
<li>persistent history</li>
<li>a command sub-shell</li>
<li>quick help (just hit the "?" key)</li>
</ul>

<p><strong>funcshell</strong> took a similar approach to features as Func; it allows developers to easily extend and customize its functionality using a plugin system. It also assumes the most useful commands will be the ones you write yourself. That being said, funcshell currently comes with both the command and service module.</p>

<p>Here are some things you can do with funcshell.</p>

<p>Get a list of all clients (not very useful if you have hundreds):</p>

<pre><code class="prettyprint">funcshell&gt; set clients *
funcshell&gt; get clients
webapp001.example.net
webapp002.example.net
webapp003.example.net
webstatic001.example.net
webstatic002.example.net
</code></pre>

<p>Assuming <code class="prettyprint">webapp00[1-3].example.net</code> are in the <code class="prettyprint">app</code> and <code class="prettyprint">bpstatic00[1-2].example.net1</code> are in the <code class="prettyprint">static</code> groups; remove some clients and restart a service:</p>

<pre><code class="prettyprint">funcshell&gt; set clients - @static;webapp001*
funcshell&gt; get clients
webapp002.example.net
webapp003.example.net
funcshell&gt; service httpd restart
==&gt; webapp003.example.net &lt;==
True
==&gt; webapp002.example.net &lt;==
True
</code></pre>

<p>Run a command and get the results:</p>

<pre><code class="prettyprint">funcshell&gt; set clients - webapp003*
funcshell&gt; set clients + webstatic002*
funcshell&gt; command run grep MemTotal /proc/meminfo | awk '{ print $2/1024 }'
==&gt; webstatic002.example.net :: 0 &lt;==
4099.44
==&gt; webapp002.example.net :: 0 &lt;==
8198.88
</code></pre>

<p>Get help:</p>

<pre><code class="prettyprint">funcshell&gt; command &lt;TAB&gt;&lt;TAB&gt;
exists   run      shell
funcshell&gt; command ?
  exists Check if a command exists
  run    Run a command
  shell  Run a command shell
</code></pre>

<p>Run a couple of commands in a row:</p>

<pre><code class="prettyprint">funcshell&gt; set c&lt;TAB&gt; @static
funcshell&gt; command shell
&gt; du -sh /tmp
==&gt; webstatic002.example.net :: 0 &lt;==
7.2M    /tmp
==&gt; webstatic001.example.net :: 0 &lt;==
3.4M    /tmp
&gt; cp -r /tmp /tmp
==&gt; webstatic002.example.net :: 1 &lt;==
cp: cannot copy a directory, '/tmp', into itself, '/tmp/tmp'
==&gt; webstatic001.example.net :: 1 &lt;==
cp: cannot copy a directory, '/tmp', into itself, '/tmp/tmp'
&gt; asdf
==&gt; webstatic002.example.net :: 127 &lt;==
/bin/sh: asdf: command not found
==&gt; webstatic001.example.net :: 127 &lt;==
/bin/sh: asdf: command not found
&gt; &lt;CTRL-D&gt;
funcshell&gt; exit
</code></pre>

<p><a href="http://github.com/silas/funcshell" title="funcshell">funcshell</a> is a shell interface to <a href="https://fedorahosted.org/func/" title="func">Func</a> which provides some useful features for managing a large number of machines.</p>]]></description>
        </item>

    </channel>
</rss>
