<?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>Solutions Log &#187; init</title> <atom:link href="http://solutions.unixsherpa.com/tag/init/feed/" rel="self" type="application/rss+xml" /><link>http://solutions.unixsherpa.com</link> <description>by Dan Reiland</description> <lastBuildDate>Tue, 05 Apr 2011 16:42:14 +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>Create a pidof command to find PID numbers easily</title><link>http://solutions.unixsherpa.com/2009/10/07/create-a-pidof-command-to-find-pid-numbers-easily/</link> <comments>http://solutions.unixsherpa.com/2009/10/07/create-a-pidof-command-to-find-pid-numbers-easily/#comments</comments> <pubDate>Wed, 07 Oct 2009 20:30:44 +0000</pubDate> <dc:creator>Dan</dc:creator> <category><![CDATA[Apple OSX]]></category> <category><![CDATA[FreeBSD]]></category> <category><![CDATA[Linux]]></category> <category><![CDATA[Shell]]></category> <category><![CDATA[Solaris]]></category> <category><![CDATA[sysadmin]]></category> <category><![CDATA[init]]></category> <category><![CDATA[pid]]></category><guid
isPermaLink="false">http://solutions.unixsherpa.com/?p=205</guid> <description><![CDATA[Most UNIX environments include the pidof command which is put to use whenever one needs to quickly determine, by name, the pid of a running program. Apple's Mac OS X lacks the pidof command, however, one may approximate its function with the following shell script: #!/bin/sh ps axc&#124;awk &#34;{if (\$5==\&#34;$1\&#34;) print \$1}&#34;; Save the script [...]]]></description> <content:encoded><![CDATA[<p><em>Most</em> UNIX environments include the pidof command which is put to use whenever one needs to quickly determine, by name, the pid of a running program. Apple's Mac OS X lacks the pidof command, however, one may approximate its function with the following shell script:</p><div
class="codecolorer-container bash twitlight" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;"><div
class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span
style="color: #666666; font-style: italic;">#!/bin/sh</span><br
/> <span
style="color: #c20cb9; font-weight: bold;">ps</span> axc<span
style="color: #000000; font-weight: bold;">|</span><span
style="color: #c20cb9; font-weight: bold;">awk</span> <span
style="color: #ff0000;">&quot;{if (<span
style="color: #000099; font-weight: bold;">\$</span>5==<span
style="color: #000099; font-weight: bold;">\&quot;</span>$1<span
style="color: #000099; font-weight: bold;">\&quot;</span>) print <span
style="color: #000099; font-weight: bold;">\$</span>1}&quot;</span>;</div></div><p>Save the script as /bin/pidof and be sure to set its executable bit:</p><div
class="codecolorer-container bash twitlight" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;"><div
class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span
style="color: #c20cb9; font-weight: bold;">chmod</span> a+x <span
style="color: #000000; font-weight: bold;">/</span>bin<span
style="color: #000000; font-weight: bold;">/</span><span
style="color: #c20cb9; font-weight: bold;">pidof</span></div></div> ]]></content:encoded> <wfw:commentRss>http://solutions.unixsherpa.com/2009/10/07/create-a-pidof-command-to-find-pid-numbers-easily/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> </channel> </rss>
<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Minified using memcached
Page Caching using memcached
Database Caching 1/12 queries in 0.002 seconds using memcached
Object Caching 422/439 objects using memcached
Content Delivery Network via Amazon Web Services: S3: unixsherpa-solutions.s3.amazonaws.com

Served from: solutions.unixsherpa.com @ 2012-02-08 13:13:49 -->
