<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	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/"
		>
<channel>
	<title>Comments on: HOWTO: create a pidfile for a startup script</title>
	<atom:link href="http://fak3r.com/2007/11/08/howto-create-a-pidfile-for-a-startup-script/feed/" rel="self" type="application/rss+xml" />
	<link>http://fak3r.com/2007/11/08/howto-create-a-pidfile-for-a-startup-script/</link>
	<description>look out honey, &#039;cause I&#039;m using technology</description>
	<lastBuildDate>Sat, 11 Feb 2012 04:52:00 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	
	<item>
		<title>By: B1519812</title>
		<link>http://fak3r.com/2007/11/08/howto-create-a-pidfile-for-a-startup-script/#comment-2793</link>
		<dc:creator>B1519812</dc:creator>
		<pubDate>Thu, 29 Dec 2011 17:42:00 +0000</pubDate>
		<guid isPermaLink="false">http://fak3r.com/2007/11/08/creating-a-pidfile-for-a-startup-script-to-use/#comment-2793</guid>
		<description>better this way:

export PIDFILE=/var/run/${1}.pid
echo &quot;$$&quot; &gt; &quot;$PIDFILE&quot;

anyway I guess the start script has to be a bit more complicated.
In fact, what happen if:

1) you starting twice the service? the script has to detect that the service is already started
2) what happen if the service crash or the script is killed? you have an unclean pidfile

this can be an alternative approach for the start

if ( set -o noclobber; echo &quot;$$&quot; &gt; &quot;$PIDFILE&quot;) 2&gt; /dev/null; 
then
   trap &#039;rm -f &quot;$PIDFILE&quot;; exit $?&#039; INT TERM EXIT 
   # starting the service in foreground here
 
   rm -f &quot;$PIDFILE&quot;   trap - INT TERM EXIT
else
   echo &quot;The service is already running with PID: $(cat $PIDFILE)&quot;fi In this case if the process crash or the script is killed, the PIDFILE will be removed.
bye
Bruno</description>
		<content:encoded><![CDATA[<p>better this way:</p>
<p>export PIDFILE=/var/run/${1}.pid<br />
echo &#8220;$$&#8221; &gt; &#8220;$PIDFILE&#8221;</p>
<p>anyway I guess the start script has to be a bit more complicated.<br />
In fact, what happen if:</p>
<p>1) you starting twice the service? the script has to detect that the service is already started<br />
2) what happen if the service crash or the script is killed? you have an unclean pidfile</p>
<p>this can be an alternative approach for the start</p>
<p>if ( set -o noclobber; echo &#8220;$$&#8221; &gt; &#8220;$PIDFILE&#8221;) 2&gt; /dev/null;<br />
then<br />
   trap &#8216;rm -f &#8220;$PIDFILE&#8221;; exit $?&#8217; INT TERM EXIT <br />
   # starting the service in foreground here<br />
 <br />
   rm -f &#8220;$PIDFILE&#8221;   trap &#8211; INT TERM EXIT<br />
else<br />
   echo &#8220;The service is already running with PID: $(cat $PIDFILE)&#8221;fi In this case if the process crash or the script is killed, the PIDFILE will be removed.<br />
bye<br />
Bruno</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: buy articles</title>
		<link>http://fak3r.com/2007/11/08/howto-create-a-pidfile-for-a-startup-script/#comment-2768</link>
		<dc:creator>buy articles</dc:creator>
		<pubDate>Thu, 08 Dec 2011 06:07:00 +0000</pubDate>
		<guid isPermaLink="false">http://fak3r.com/2007/11/08/creating-a-pidfile-for-a-startup-script-to-use/#comment-2768</guid>
		<description>Hey I love your style I will subscribe for your feed please keep posting!Well done.</description>
		<content:encoded><![CDATA[<p>Hey I love your style I will subscribe for your feed please keep posting!Well done.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Neurologist in Rye Brook NY</title>
		<link>http://fak3r.com/2007/11/08/howto-create-a-pidfile-for-a-startup-script/#comment-2715</link>
		<dc:creator>Neurologist in Rye Brook NY</dc:creator>
		<pubDate>Thu, 27 Oct 2011 14:53:00 +0000</pubDate>
		<guid isPermaLink="false">http://fak3r.com/2007/11/08/creating-a-pidfile-for-a-startup-script-to-use/#comment-2715</guid>
		<description>Hi,
Generally I do not post on blogs, but I would like to say that this post really forced me to do so! really nice post.</description>
		<content:encoded><![CDATA[<p>Hi,<br />
Generally I do not post on blogs, but I would like to say that this post really forced me to do so! really nice post.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: alexander technique</title>
		<link>http://fak3r.com/2007/11/08/howto-create-a-pidfile-for-a-startup-script/#comment-2698</link>
		<dc:creator>alexander technique</dc:creator>
		<pubDate>Sat, 15 Oct 2011 06:08:00 +0000</pubDate>
		<guid isPermaLink="false">http://fak3r.com/2007/11/08/creating-a-pidfile-for-a-startup-script-to-use/#comment-2698</guid>
		<description>Wow!Excellent feedback with have goal theam.I like it &amp; will try to keep it mind.</description>
		<content:encoded><![CDATA[<p>Wow!Excellent feedback with have goal theam.I like it &amp; will try to keep it mind.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: law tutor Perth</title>
		<link>http://fak3r.com/2007/11/08/howto-create-a-pidfile-for-a-startup-script/#comment-2687</link>
		<dc:creator>law tutor Perth</dc:creator>
		<pubDate>Thu, 13 Oct 2011 09:37:00 +0000</pubDate>
		<guid isPermaLink="false">http://fak3r.com/2007/11/08/creating-a-pidfile-for-a-startup-script-to-use/#comment-2687</guid>
		<description>hey i thought this was a great read so i added this to facebook.</description>
		<content:encoded><![CDATA[<p>hey i thought this was a great read so i added this to facebook.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Nik</title>
		<link>http://fak3r.com/2007/11/08/howto-create-a-pidfile-for-a-startup-script/#comment-2683</link>
		<dc:creator>Nik</dc:creator>
		<pubDate>Wed, 12 Oct 2011 11:14:00 +0000</pubDate>
		<guid isPermaLink="false">http://fak3r.com/2007/11/08/creating-a-pidfile-for-a-startup-script-to-use/#comment-2683</guid>
		<description>well... 
cut -d&quot; &quot; -f6 works just for usernames containing 4 characters, because the field-number depends on the amount of blanks between username and pid. ist there a way to cut the fields with delimiters containing on or more of the same characters ? maby RegEx ?</description>
		<content:encoded><![CDATA[<p>well&#8230;<br />
cut -d&#8221; &#8221; -f6 works just for usernames containing 4 characters, because the field-number depends on the amount of blanks between username and pid. ist there a way to cut the fields with delimiters containing on or more of the same characters ? maby RegEx ?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Archive Storage</title>
		<link>http://fak3r.com/2007/11/08/howto-create-a-pidfile-for-a-startup-script/#comment-2673</link>
		<dc:creator>Archive Storage</dc:creator>
		<pubDate>Sat, 08 Oct 2011 12:38:00 +0000</pubDate>
		<guid isPermaLink="false">http://fak3r.com/2007/11/08/creating-a-pidfile-for-a-startup-script-to-use/#comment-2673</guid>
		<description>Ya !I am really glad I have found this information. A good blog with exciting content, that’s what I need. Thank you for keeping this site, I will be visiting it. Cant find it.</description>
		<content:encoded><![CDATA[<p>Ya !I am really glad I have found this information. A good blog with exciting content, that’s what I need. Thank you for keeping this site, I will be visiting it. Cant find it.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Dev</title>
		<link>http://fak3r.com/2007/11/08/howto-create-a-pidfile-for-a-startup-script/#comment-2536</link>
		<dc:creator>Dev</dc:creator>
		<pubDate>Wed, 06 Jul 2011 07:18:00 +0000</pubDate>
		<guid isPermaLink="false">http://fak3r.com/2007/11/08/creating-a-pidfile-for-a-startup-script-to-use/#comment-2536</guid>
		<description>Write a C/C++ program that finds the MySQL PID file and prints its contents. Assume that your application will run on the same system running MySQL.</description>
		<content:encoded><![CDATA[<p>Write a C/C++ program that finds the MySQL PID file and prints its contents. Assume that your application will run on the same system running MySQL.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: fak3r</title>
		<link>http://fak3r.com/2007/11/08/howto-create-a-pidfile-for-a-startup-script/#comment-921</link>
		<dc:creator>fak3r</dc:creator>
		<pubDate>Thu, 01 Apr 2010 04:39:36 +0000</pubDate>
		<guid isPermaLink="false">http://fak3r.com/2007/11/08/creating-a-pidfile-for-a-startup-script-to-use/#comment-921</guid>
		<description>perfect!  I&#039;ve never heard of that, thanks</description>
		<content:encoded><![CDATA[<p>perfect!  I&#039;ve never heard of that, thanks</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Luke</title>
		<link>http://fak3r.com/2007/11/08/howto-create-a-pidfile-for-a-startup-script/#comment-920</link>
		<dc:creator>Luke</dc:creator>
		<pubDate>Thu, 01 Apr 2010 04:20:11 +0000</pubDate>
		<guid isPermaLink="false">http://fak3r.com/2007/11/08/creating-a-pidfile-for-a-startup-script-to-use/#comment-920</guid>
		<description>See: &lt;a href=&quot;http://libslack.org/daemon/manpages/daemon.1.html&quot; rel=&quot;nofollow&quot;&gt;http://libslack.org/daemon/manpages/daemon.1.html&lt;/a&gt;</description>
		<content:encoded><![CDATA[<p>See: <a href="http://libslack.org/daemon/manpages/daemon.1.html" rel="nofollow">http://libslack.org/daemon/manpages/daemon.1.html</a></p>
]]></content:encoded>
	</item>
</channel>
</rss>

