<?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>logIt &#187; daemon</title>
	<atom:link href="https://lakm.us/logit/tag/daemon/feed/" rel="self" type="application/rss+xml" />
	<link>https://lakm.us/logit</link>
	<description>Log Around The Clock</description>
	<lastBuildDate>Sat, 06 Jun 2015 14:17:37 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.5.1</generator>
		<item>
		<title>Running Two Squid Instances in Upstart Init</title>
		<link>https://lakm.us/logit/2013/05/running-two-multiple-squid-instances-upstart-init-job/</link>
		<comments>https://lakm.us/logit/2013/05/running-two-multiple-squid-instances-upstart-init-job/#comments</comments>
		<pubDate>Fri, 10 May 2013 08:55:16 +0000</pubDate>
		<dc:creator>Arif</dc:creator>
				<category><![CDATA[General Linux]]></category>
		<category><![CDATA[Ubuntu]]></category>
		<category><![CDATA[daemon]]></category>
		<category><![CDATA[proxy]]></category>
		<category><![CDATA[squid]]></category>
		<category><![CDATA[startup]]></category>
		<category><![CDATA[workaround]]></category>

		<guid isPermaLink="false">http://lakm.us/logit/?p=644</guid>
		<description><![CDATA[After installing squid3 from repository, Ubuntu will place the init in upstart style (instead of /etc/rc*.d/ or /etc/init.d/ style used to maintain backward compatibility to legacy System-V init). The upstart job is placed in /etc/init/squid3.conf with default runlevel (2,3,4 or 5) to start the instance during reboot and relevant start/stop command using service: $ sudo [...]]]></description>
				<content:encoded><![CDATA[<p>After installing <a href="http://www.squid-cache.org/" target="_blank">squid3</a> from <a href="http://packages.ubuntu.com/precise/squid3" target="_blank">repository</a>, Ubuntu will place the <code>init</code> in <a href="http://upstart.ubuntu.com/" target="_blank">upstart</a> style (instead of <code>/etc/rc*.d/</code> or <code>/etc/init.d/</code> style used to maintain backward compatibility to legacy <a href="http://en.wikipedia.org/wiki/Init" target="_blank">System-V init</a>). The upstart job is placed in <code>/etc/init/squid3.conf</code> with default <code>runlevel</code> (2,3,4 or 5) to start the instance during reboot and relevant start/stop command using <code>service</code>:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ <span style="color: #c20cb9; font-weight: bold;">sudo</span> service squid3 <span style="color: #7a0874; font-weight: bold;">&#123;</span>start<span style="color: #000000; font-weight: bold;">|</span>stop<span style="color: #000000; font-weight: bold;">|</span>restart<span style="color: #7a0874; font-weight: bold;">&#125;</span></pre></div></div>

<p>To specify what to run, an <code>upstart</code> <a href="http://upstart.ubuntu.com/getting-started.html" target="_blank">must have</a> <code>exec</code> or <code>script</code> stanza. When the goal is to start two or more (multiple) instances of <code>squid3</code>, <code>exec</code> is meant <a href="http://manpages.ubuntu.com/manpages/precise/man3/exec.3.html" target="_blank">to replace existing process image</a> of <code>/usr/sbin/squid3</code> executable, therefore will not start two instances.</p>
<div class="wp-caption aligncenter" style="width: 460px"><img alt="Eltek Smartpack Controller type with SNMP Support" src="../../../../images/squid3-two-instances-illustration.png" title="Multiple squid3 instances started via upstart exec" width="385" height="188" /><p class="wp-caption-text">Multiple squid3 instances started via upstart exec</p></div>
<p>As workaround we can have symbolic link to <code>squid3</code> executable instead and add new <code>upstart</code> job configuration with <code>exec</code> call to the link. I need two instances running in the same machine due to the implementation design where the fist instance is HTTP proxy cache while the second one is accelerator/interceptor (reverse proxy) that serves default landing page telling user to use proxy (and how to do that). Hence, for the second instance I add:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">lrwxrwxrwx <span style="color: #000000;">1</span> root root <span style="color: #000000;">6</span> May  <span style="color: #000000;">3</span> 09:<span style="color: #000000;">25</span> <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>sbin<span style="color: #000000; font-weight: bold;">/</span>squid3ins2 -<span style="color: #000000; font-weight: bold;">&gt;</span> squid3
<span style="color: #660033;">-rw-r--r--</span> <span style="color: #000000;">1</span> root root <span style="color: #000000;">1156</span> May  <span style="color: #000000;">6</span> <span style="color: #000000;">13</span>:<span style="color: #000000;">30</span> <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>init<span style="color: #000000; font-weight: bold;">/</span>squid3ins2.conf</pre></div></div>

<p>and for the first instance I add:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #660033;">-rw-r--r--</span> <span style="color: #000000;">1</span> root root <span style="color: #000000;">298</span> May  <span style="color: #000000;">3</span> <span style="color: #000000;">10</span>:<span style="color: #000000;">13</span> <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>init<span style="color: #000000; font-weight: bold;">/</span>squid3.override</pre></div></div>

<p><code>squid3ins2</code> is our link and <code>/etc/init/squid3ins2.conf</code> contains <code>exec</code> call to it to run second <code>squid3</code>. For the first instance I choose to write an override (<code>/etc/init/squid3.override</code>) so that the original job configuration file is left intact. For the complete content of all files check <a href="https://github.com/bandono/proxyConf/tree/v1.1/init" target="_blank">my github v1.1</a> of the Squid integration. There, in details you&#8217;ll also find how both instances PID, log, etc. are differentiated by each instance config via the following directives:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">http_port
cache_dir
pid_filename
cache_access_log
cache_log</pre></div></div>

</pre>
]]></content:encoded>
			<wfw:commentRss>https://lakm.us/logit/2013/05/running-two-multiple-squid-instances-upstart-init-job/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>That Handy Tap Interface on Mac OSX</title>
		<link>https://lakm.us/logit/2013/01/handy-tap-interface-mac-osx/</link>
		<comments>https://lakm.us/logit/2013/01/handy-tap-interface-mac-osx/#comments</comments>
		<pubDate>Fri, 04 Jan 2013 09:04:46 +0000</pubDate>
		<dc:creator>Arif</dc:creator>
				<category><![CDATA[Moving to Mac]]></category>
		<category><![CDATA[daemon]]></category>
		<category><![CDATA[networking]]></category>
		<category><![CDATA[OS X]]></category>
		<category><![CDATA[python]]></category>
		<category><![CDATA[virtualization]]></category>

		<guid isPermaLink="false">http://lakm.us/logit/?p=426</guid>
		<description><![CDATA[Ubuntu has been my desktop for some years. I&#8217;ve become so attached in a way that I no longer know how to work without. Then of course, the pain of moving to Mac is one foreseeable future. Unlike my usual repository where everything is on the table and for free, this one is a little [...]]]></description>
				<content:encoded><![CDATA[<p><a href="http://www.ubuntu.com/" title="Ubuntu" target="_blank">Ubuntu</a> has been my desktop for some years. I&#8217;ve become so attached in a way that I no longer know how to work without. Then of course, the pain of moving to <a href="http://www.apple.com/macbook-pro/" title="MacBook Pro" target="_blank">Mac</a> is one foreseeable future. Unlike my usual repository where everything is on the table and for free, this one is a little tougher to handle. Well, if I were to cut to the chase, <a href="./2009/02/startup-script-for-tap-interfaces/" title="Startup script for TAP interfaces" target="_blank">tap interface</a> for instance, was nowhere near to be found. My <a href="https://www.virtualbox.org/" title="VirtualBox" target="_blank">VirtualBox</a> depends a lot on these virtual networks as I&#8217;m used to try things out.</p>
<blockquote><p>
<em>..you’ll always have love-hate relationship with the tools you work with.. blindly turning yourself into devoted-fanatic is another thing..</em></p></blockquote>
<p>
<p>Enough bragging (let&#8217;s spare that). First we need to have <code>/dev/tap0</code>, <code>/dev/tap1</code>, etc., available using <a href="http://tuntaposx.sourceforge.net/" title="TunTap - SourceForge" target="_blank">TunTap</a> kernel extension.</p>
<p>I modify the small script from <a href="http://snakeoilresearch.com/blog_discussing_snake_oil_o/using_taptun_interfaces_in_.html" title="Using 'tap/tun' interfaces in Mac OS X with VirtualBox" target="_blank">this post</a> to have it available on background instead of keeping a shell open all the time:</p>
<p>I saved it as <code>/usr/local/bin/setup-tap1.py</code></p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
</pre></td><td class="code"><pre class="python" style="font-family:monospace;"><span style="color: #808080; font-style: italic;">#!/usr/bin/python</span>
&nbsp;
<span style="color: #ff7700;font-weight:bold;">import</span> <span style="color: #dc143c;">os</span>
<span style="color: #ff7700;font-weight:bold;">while</span> <span style="color: #ff4500;">1</span>:
	<span style="color: #ff7700;font-weight:bold;">try</span>:
		file_path = <span style="color: #483d8b;">'/dev/tap1'</span>
		dev_file = <span style="color: #dc143c;">os</span>.<span style="color: #008000;">open</span><span style="color: black;">&#40;</span>file_path, <span style="color: #dc143c;">os</span>.<span style="color: black;">O_RDWR</span><span style="color: black;">&#41;</span>
		interface = <span style="color: #483d8b;">'tap1'</span>
		<span style="color: #ff7700;font-weight:bold;">while</span> <span style="color: #ff4500;">1</span>:
			<span style="color: #ff7700;font-weight:bold;">pass</span>
	<span style="color: #ff7700;font-weight:bold;">except</span>:
		<span style="color: #ff7700;font-weight:bold;">print</span> <span style="color: #483d8b;">&quot;tap interface is closing&quot;</span>
		exit<span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>
		<span style="color: #ff7700;font-weight:bold;">break</span></pre></td></tr></table></div>

<p>Let the shell takes care of putting it to background (daemon):</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #7a0874; font-weight: bold;">&#91;</span>root<span style="color: #7a0874; font-weight: bold;">&#93;</span>$ <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>local<span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span>setup-tap1.py <span style="color: #000000; font-weight: bold;">&amp;</span></pre></div></div>

<p>and there you have one working tap interface:</p>
<div class="wp-caption aligncenter" style="width: 460px"><img alt="virtualbox-mac-osx-tap-interface.png" src="../../../../images/virtualbox-mac-osx-tap-interface.png" title="VirtualBox tap interface in Mac OSX Lion" width="438" height="249" /><p class="wp-caption-text">VirtualBox tap interface in Mac OSX Lion 10.7</p></div>
<p>[Moving-in would probably be easier if I started <code>life</code> with <code><a href="http://en.wikipedia.org/wiki/FreeBSD" title="FreeBSD" target="_blank">FreeBSD</a></code>. More posts to come]</p>
]]></content:encoded>
			<wfw:commentRss>https://lakm.us/logit/2013/01/handy-tap-interface-mac-osx/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Install Nagios 3 and Plugins</title>
		<link>https://lakm.us/logit/2009/10/install-nagios-3-and-plugins/</link>
		<comments>https://lakm.us/logit/2009/10/install-nagios-3-and-plugins/#comments</comments>
		<pubDate>Thu, 22 Oct 2009 05:48:46 +0000</pubDate>
		<dc:creator>Arif</dc:creator>
				<category><![CDATA[General Linux]]></category>
		<category><![CDATA[application]]></category>
		<category><![CDATA[CGI]]></category>
		<category><![CDATA[daemon]]></category>
		<category><![CDATA[make-install]]></category>
		<category><![CDATA[monitoring]]></category>
		<category><![CDATA[OSS]]></category>
		<category><![CDATA[web-based]]></category>

		<guid isPermaLink="false">http://localhost/it/?p=95</guid>
		<description><![CDATA[Quickstart I decided to install in RedHat 5.2. Maybe it is easier in Ubuntu (Nagios 3 already listed in the repository, but I haven&#8217;t tried it). As pointed out by the quickstart (it is meant for Fedora by the way), requirements are: php, httpd gcc, glibc, glibc-common gd, gd-devel After getting those, the configure-make-install procedure [...]]]></description>
				<content:encoded><![CDATA[<h3>Quickstart</h3>
<p>I decided to install in RedHat 5.2. Maybe it is easier in Ubuntu (Nagios 3 already listed in the repository, but I haven&#8217;t tried it). As pointed out by the quickstart (it is meant for Fedora by the way), requirements are:</p>
<ol>
<li><span style="background-color: #ffffff;">php, httpd </span></li>
<li><span style="background-color: #ffffff;">gcc, glibc, glibc-common</span></li>
<li><span style="background-color: #ffffff;">gd, gd-devel</span></li>
</ol>
<p>After getting those, the <code>configure-make-install</code> procedure runs well, except that I don&#8217;t check the warnings. It turns out that only some of Nagios core components are installed. It can be seen from the content of <code>/usr/local/nagios/libexec</code> directory. There is no <code>check_snmp</code> etc. Error also appears in statusmap page of Nagios.</p>
<h3>Compile More Nagios Core Components</h3>
<p>I run through <code>./configure</code> once more, check out all warnings, and begin to evaluate <strong>requirements</strong> (found this text inside <code>nagios-plugins-1.4.14</code> tarball)</p>
<h4>MySQL</h4>
<p>For <code>check_mysql</code> functionality, <code>mysql</code> (MySQL client for linux) must be installed. <code>./configure</code> also test this client, by default config, to the local MySQL socket, hence <code>mysql-server</code> must also exist.</p>
<h4>Radius Client</h4>
<p>Client from freeradius package doesn&#8217;t meet Nagios requirements. It must be the ones from original radiusclient, I found RPMs for  <code>radiusclient-0.3.2-0.2.el5.rf.i386.rpm</code> and <code>radiusclient-devel-0.3.2-0.2.el5.rf.i386.rpm</code>.</p>
<h4>GD</h4>
<p>It is quite tricky to get <code>statusmap.c</code> to be compiled for the <code>.cgi</code> of Nagios status map. Compilation needs <code>gd</code> library from <a href="http://www.libgd.org/">http://www.libgd.org/</a>. <code>gd</code> requires <code>zlib</code>, <code>libjpeg</code>, and <code>libpng</code>. On first attempt, I installed from RPMs. This appeared to be not working as I could still see warnings about <code>gd2</code> during .<code>/configure</code>.</p>
<p>So, I choose to compile from the source <code>gd-2.0.33.tar.bz2</code>. This tarball was found in the older section of current <code>gd2</code> web. I chose this version because the RPM used was <code>gd-2.0.33-9.4.el5_1.1.rpm</code>. I removed this RPM first which made me to remove also <code>libmwf</code> and <code>ImageMagick</code>.</p>
<p>After straightforward  <code>configure-make-install</code> the library will be installed under <code>/usr/local/lib</code> i.e <code>libgd.so.2.0.0</code>. Header files will also be available in /<code>usr/local/include</code> i.e <code>gd.h</code>. These are different from the situation when I installed from RPM where <code>libgd.so.2.0.0</code> is under <code>/usr/lib/</code> and no <code>gd.h</code> found under <code>/usr/include</code>.</p>
<p>So, I <code>make devclean</code> and rerun</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">.<span style="color: #000000; font-weight: bold;">/</span>configure <span style="color: #660033;">--with-gd-lib</span>=<span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>local<span style="color: #000000; font-weight: bold;">/</span>lib <span style="color: #660033;">--with-gd-inc</span>=<span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>local<span style="color: #000000; font-weight: bold;">/</span>include <span style="color: #660033;">--with-command-group</span>=nagcmd</pre></div></div>

<p>I configure the /usr/local/nagios/etc/cgi.conf but status map page is still empty. Next workaround is to install back  <code>gd-2.0.33-9.4.el5_1.1.rpm</code>. (which also bring back <code>libmwf</code> and <code>ImageMagick</code>) and point the <code>gd</code> library to the ones created from RPM. I <code>make devclean</code> and rerun:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">.<span style="color: #000000; font-weight: bold;">/</span>configure <span style="color: #660033;">--with-gd-lib</span>=<span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>lib <span style="color: #660033;">--with-gd-inc</span>=<span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>local<span style="color: #000000; font-weight: bold;">/</span>include <span style="color: #660033;">--with-command-group</span>=nagcmd</pre></div></div>

<p>At this point I regret not to have Ubuntu implementation in the first place. Just a small regret.</p>
<p>Other library needed for <code>check_smtp</code>, <code>check_http</code>, etc. don&#8217;t seem to trouble me much, I need <code>openssl</code>, <code>openldap</code>, etc. and simply get them from RPMs.</p>
]]></content:encoded>
			<wfw:commentRss>https://lakm.us/logit/2009/10/install-nagios-3-and-plugins/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Tagsistant (1)</title>
		<link>https://lakm.us/logit/2009/09/tagsistant-1/</link>
		<comments>https://lakm.us/logit/2009/09/tagsistant-1/#comments</comments>
		<pubDate>Wed, 09 Sep 2009 06:09:59 +0000</pubDate>
		<dc:creator>Arif</dc:creator>
				<category><![CDATA[Ubuntu]]></category>
		<category><![CDATA[application]]></category>
		<category><![CDATA[daemon]]></category>
		<category><![CDATA[file system]]></category>
		<category><![CDATA[fuse]]></category>
		<category><![CDATA[install-deinstall]]></category>
		<category><![CDATA[make-install]]></category>
		<category><![CDATA[tagging]]></category>

		<guid isPermaLink="false">http://localhost/it/?p=82</guid>
		<description><![CDATA[Installation of tagsistant requires SQLite and FUSE, in Ubuntu they are satisfied as libsqlite3-dev and libfuse-dev (which will also requires libselinux1-dev and libsepol1-dev). A series of configure, make, and make-install will fail during the make-install. /usr/local/share/pixmaps must be created first before running $ sudo make install After that I test tagsistant to organize /data/tags/ $ [...]]]></description>
				<content:encoded><![CDATA[<p>Installation of <strong>tagsistant</strong> requires SQLite and FUSE, in Ubuntu they are satisfied as libsqlite3-dev and libfuse-dev (which will also requires libselinux1-dev and libsepol1-dev). A series of configure, make, and make-install will fail during the make-install. <code>/usr/local/share/pixmaps</code> must be created first before running</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ <span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">make</span> <span style="color: #c20cb9; font-weight: bold;">install</span></pre></div></div>

<p>After that I test tagsistant to organize <code>/data/tags/</code></p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ tagsistant <span style="color: #000000; font-weight: bold;">/</span>data<span style="color: #000000; font-weight: bold;">/</span>tags</pre></div></div>

<p>The tagging works as expected but not too handy since no browser GUI is embedded. It is just like browsing through multiple OR and AND folders.</p>
<p>The installation process will also install <strong>tagman</strong> (a tag manager GUI) if <code>libgtk2.0-dev</code> and <code>libglib2.0-dev</code> are installed.</p>
]]></content:encoded>
			<wfw:commentRss>https://lakm.us/logit/2009/09/tagsistant-1/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
