<?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>My Galagzee! &#187; install</title>
	<atom:link href="http://my.galagzee.com/tag/install/feed/" rel="self" type="application/rss+xml" />
	<link>http://my.galagzee.com</link>
	<description>Tech in a Galagzee, Not So Far Away.</description>
	<lastBuildDate>Wed, 28 Jul 2010 17:09:34 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>Installing bcron on FreeBSD 7.0</title>
		<link>http://my.galagzee.com/2008/06/30/installing-bcron-on-freebsd-70/</link>
		<comments>http://my.galagzee.com/2008/06/30/installing-bcron-on-freebsd-70/#comments</comments>
		<pubDate>Mon, 30 Jun 2008 23:42:46 +0000</pubDate>
		<dc:creator>Ville Walveranta</dc:creator>
				<category><![CDATA[Technical]]></category>
		<category><![CDATA[bcron]]></category>
		<category><![CDATA[freebsd]]></category>
		<category><![CDATA[install]]></category>

		<guid isPermaLink="false">http://my.galagzee.com/?p=77</guid>
		<description><![CDATA[bcron is a better cron (though the &#8220;b&#8221; in the name probably comes from the first name of its writer, Bruce Guenter).  It was created with security in mind, and is especially well suited for multi-user systems where the individual users need to be given access to their respective crontabs. With bcron this can be]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.untroubled.org/bcron/" target="_blank">bcron</a> is a better cron (though the &#8220;b&#8221; in the name probably comes from the first name of its writer, Bruce Guenter).  It was created with security in mind, and is especially well suited for multi-user systems where the individual users need to be given access to their respective crontabs. With bcron this can be accomplished without compromising the system security.  Here&#8217;s a quote from the bcron page:</p>
<blockquote><p>This is bcron, a new cron system designed with secure operations in mind.  To do this, the system is divided into several seperate programs, each responsible for a seperate task, with strictly controlled communications between them.  The user interface is a drop-in replacement for similar systems (such as vixie-cron), but the internals differ greatly.</p></blockquote>
<p>As of writing of this bcron can not be found in the FreeBSD 7.0 ports system. Fortunately its installation is fairly straightforward.  Yet the included documentation is rather spartan so I provide a more complete outline below.</p>
<ol>
<li><strong>Install latest bglibs if not yet installed</strong>** bglibs is best to install from a <a href="http://www.untroubled.org/bglibs/" target="_blank">downloaded tarball</a> rather than from the ports (while the ports version installs the libs in a more logical location at /usr/local/lib/bglibs/ the programs that utilize the library (bcron, ucspi-unix, etc.) have difficulty locating it.
<p>** few symlinks are required (these refer to the locations bglibs installs itself when compiled from the tarball rather than from the ports):</p>
<p>/usr/local/bglibs -&gt; /usr/local/lib/bglibs<br />
/usr/local/bglibs/lib/libbg-sysdeps.so.2 -&gt; /usr/local/lib/libbg-sysdeps.so.2<br />
/usr/local/bglibs/lib/libbg.so.2 -&gt; /usr/local/lib/libbg.so.2</li>
<li><strong>Install </strong><strong>ucspi-unix if not yet installed </strong>as bcron components communicate via UNIX sockets.<strong> </strong>This requires bglibs and also compiles and installs well using a <a href="http://www.untroubled.org/ucspi-unix/" target="_blank">downloaded tarball</a> (it&#8217;s also available in ports at /usr/ports/sysutils/ucspi-unix, but I prefer to compile it from the downloaded tarball).</li>
<li><strong>Make sure /var has been moved off the root to /usr/var</strong> before proceeding. See an <a href="http://my.galagzee.com/index.php/2008/06/28/moving-var-tmp-off-the-root-in-freebsd/" target="_self">older post</a> for details.</li>
<li><strong>Make sure <a href="http://my.galagzee.com/index.php/2008/06/30/installing-daemontools-service-supervisor-on-freebsd-70/" target="_self">daemontools (and hence supervise) has been installed</a></strong> and is operational as bcron will be started with it.</li>
<li><strong>Create a system user &#8220;cron&#8221; </strong>(for example by using <strong>vipw</strong> command) <strong>and group &#8220;cron&#8221; </strong>(by editing /etc/group). This user/group will own all the crontab files (though not /etc/crontab as it&#8217;s system crontab and needs to be owned by root:wheel).<em> </em><em> </em><em> </em><br />
<em><br />
user:</em><br />
cron:*:50:50::0:0:BCron Sandbox:/nonexistent:/usr/sbin/nologin</p>
<p><em>group:</em><br />
cron:*:50:</li>
<li><strong>Create the spool &amp; tmp directories: </strong><br />
mkdir -p /var/spool/cron/crontabs /var/spool/cron/tmp<br />
mkfifo /var/spool/cron/trigger<br />
sh<br />
for i in crontabs tmp trigger; do<br />
chown cron:cron /var/spool/cron/$i<br />
chmod go-rwx /var/spool/cron/$i<br />
done</li>
<li><strong>Create the configuration directory /usr/local/etc/bcron:</strong>mkdir -p /usr/local/etc/bcron** You can put any common configuration settings into this directory (it is an &#8220;ENVDIR&#8221;), like alternate spool directories in BCRON_SPOOL.</li>
<li><strong>Create the bcron service directories (there are three services) and add the scripts below it:
<p></strong>mkdir -p /var/bcron/supervise/bcron-sched/log<br />
mkdir /var/bcron/supervise/bcron-spool<br />
mkdir /var/bcron/supervise/bcron-update</p>
<p>Set their permissions to 1750 for security purposes (no world access, sticky bit):</p>
<p>chmod 1750 /var/bcron/supervise/bcron-sched<br />
chmod 1750 /var/bcron/supervise/bcron-spool<br />
chmod 1750 /var/bcron/supervise/bcron-update</p>
<p>Make all the run and log/run scripts executable by root, readable by group:</p>
<p>chmod 740 /var/bcron/supervise/bcron-sched/run<br />
chmod 740 /var/bcron/supervise/bcron-sched/log/run<br />
chmod 740 /var/bcron/supervise/bcron-spool/run<br />
chmod 740 /var/bcron/supervise/bcron-update/run</p>
<p>and make log bcron-sched subdir accessible by root, group:</p>
<p>chmod 750 /var/bcron/supervise/bcron-sched/log</p>
<p><strong>RUN SCRIPTS:</strong><br />
<span style="text-decoration: underline;"><em>/var/bcron/supervise/bcron-sched/run:</em></span></p>
<p>#!/bin/sh<br />
exec 2&gt;&amp;1<br />
exec envdir /usr/local/etc/bcron bcron-start | multilog t /var/log/bcron</p>
<p><span style="text-decoration: underline;"><em>/var/bcron/supervise/bcron-sched/log/run:</em></span></p>
<p>#!/bin/sh<br />
exec &gt;/dev/null 2&gt;&amp;1<br />
exec \<br />
multilog t /var/log/bcron</p>
<p><span style="text-decoration: underline;"><em>/var/bcron/supervise/bcron-spool/run:</em></span></p>
<p>#!/bin/sh<br />
exec &gt;/dev/null 2&gt;&amp;1<br />
exec \<br />
envdir /usr/local/etc/bcron \<br />
envuidgid cron \<br />
sh -c &#8216;<br />
exec \<br />
unixserver -U ${BCRON_SOCKET:-/var/run/bcron-spool} \<br />
bcron-spool<br />
&#8216;</p>
<p><span style="text-decoration: underline;"><em>/var/bcron/supervise/bcron-update/run:</em></span></p>
<p>#!/bin/sh<br />
exec &gt;/dev/null 2&gt;&amp;1<br />
exec \<br />
bcron-update /etc/crontab</li>
<li><strong>Kill the deafult cron daemon and add the following to rc.conf so it won&#8217;t restart on reboot:</strong>
<p>#disable default cron; bcron is used instead (started by supervise)<br />
cron_enable=&#8221;NO&#8221;</li>
<li><strong>Symlink bcron services&#8217; primary supervise directories to under /var/service to start bcron services (you can also use svc-add command if you have installed supervise-scripts):</strong><br />
ln -s /var/bcron/supervise/bcron-sched /var/service/bcron-sched<br />
ln -s /var/bcron/supervise/bcron-spool /var/service/bcron-spool<br />
ln -s /var/bcron/supervise/bcron-update /var/service/bcron-update</li>
<li><strong>Set /etc/crontab permissions to 600, and make sure it&#8217;s owned by the root.</strong><br />
chmod 600 /etc/crontab<br />
chown root:wheel /etc/crontab</p>
<p>** For other users the owner of the crontab file in their respective home folders would be <strong>cron:cron</strong>.</li>
<li><strong>Edit /etc/crontab and test that it gets updated</strong>. Note that there is a brief delay, perhaps one minute or so, after you save the crontab until the change becomes effective. Also note that the default shell for the crontab is /bin/sh. You might want to change it to something more powerful like c-shell (/bin/csh) or bash (/bin/bash) that you&#8217;re familiar with. You may also want to augment the default path, for example, by including /usr/local/bin for user-installed commands.</li>
</ol>
]]></content:encoded>
			<wfw:commentRss>http://my.galagzee.com/2008/06/30/installing-bcron-on-freebsd-70/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Installing daemontools service supervisor on FreeBSD 7.0</title>
		<link>http://my.galagzee.com/2008/06/30/installing-daemontools-service-supervisor-on-freebsd-70/</link>
		<comments>http://my.galagzee.com/2008/06/30/installing-daemontools-service-supervisor-on-freebsd-70/#comments</comments>
		<pubDate>Mon, 30 Jun 2008 20:06:18 +0000</pubDate>
		<dc:creator>Ville Walveranta</dc:creator>
				<category><![CDATA[Technical]]></category>
		<category><![CDATA[daemontools]]></category>
		<category><![CDATA[install]]></category>
		<category><![CDATA[supervise]]></category>
		<category><![CDATA[supervisor]]></category>

		<guid isPermaLink="false">http://my.galagzee.com/?p=78</guid>
		<description><![CDATA[D. J. Bernstein&#8217;s daemontools includes a service supervisor which ensures services it supervises are restarted should they ever stop due to a program/system error. Daemontoos is easy to install, and is best installed from FreeBSD&#8217;s ports system at /usr/ports/sysutils/daemontools.  Be sure to also install the manual, which you can find in a sub-directory work/daemontools-man. The]]></description>
			<content:encoded><![CDATA[<p>D. J. Bernstein&#8217;s <a href="http://cr.yp.to/daemontools.html" target="_blank">daemontools</a> includes a service supervisor which ensures services it supervises are restarted should they ever stop due to a program/system error. Daemontoos is easy to install, and is best installed from FreeBSD&#8217;s ports system at <strong>/usr/ports/sysutils/daemontools</strong>.  Be sure to also install the manual, which you can find in a sub-directory <strong>work/daemontools-man</strong>. The README file that can be found within instructs to [manually] install the manual entries using the command <strong>gzip *.8 ; cp *.8.gz /usr/share/man/man8/</strong> (while residing in the daemontools-man directory). Once installed, there are few additional steps to do:</p>
<ol>
<li>Copy <strong>/usr/ports/sysutils/daemontools/work/svscan.sh.sample</strong> to<br />
<strong>/usr/local/etc/rc.d/svscan.sh</strong> and give it owner execute privileges with <strong><br />
chmod 700 /usr/local/etc/rc.d/svscan.sh</strong></li>
<li><strong>Create /var/service and create a symlink to it from /service<br />
</strong>mkdir /var/service<br />
ln -s /var/service /service</li>
<li><strong>Add following to /etc/rc.conf:</strong><br />
#start /var/service scanning<br />
svscan_enable=&#8221;YES&#8221;</li>
<li><strong>Reboot the system (svscan will *not* start on a BSD system before the system is rebooted)<br />
</strong></li>
</ol>
<p>Optionally you can also install Bruce Guenter&#8217;s supervise-scripts that make life a whole lot easier with daemontools&#8217; supervise.</p>
<ol>
<li><strong>Install latest bglibs if not yet installed</strong><br />
** bglibs is best to install from a <a href="http://www.untroubled.org/bglibs/" target="_blank">downloaded tarball</a> rather than from the ports (while the ports version installs the libs in a more logical location at /usr/local/lib/bglibs/ the programs that utilize the library (bcron, ucspi-unix, etc.) have difficulty locating it.** few symlinks are required (these refer to the locations bglibs installs itself when compiled from the tarball rather than from the ports):<br />
/usr/local/bglibs -&gt; /usr/local/lib/bglibs<br />
/usr/local/bglibs/lib/libbg-sysdeps.so.2 -&gt; /usr/local/lib/libbg-sysdeps.so.2<br />
/usr/local/bglibs/lib/libbg.so.2 -&gt; /usr/local/lib/libbg.so.2</li>
<li><strong>Download, compile, and install <a href="http://www.untroubled.org/supervise-scripts/" target="_blank">supervise-scripts</a>.</strong> Once installed, you&#8217;ll find new commands <em>svc-start, svc-stop, svc-restart, svc-add, svc-remove, svc-isdown, svc-isup, svc-waitdown, svc-waitup, and svc-status</em> in /usr/local/bin. These make scripting and managing services much easier.</li>
</ol>
<p>When switching programs to be svscan-started and svscan-managed, remember to make sure they&#8217;re not being started either as default services by the system, or that a prior startup setting doesn&#8217;t exist in  /etc/rc.conf. Disable them (depending on the service) by commenting out the startup in /etc/rc.conf, by adding a &#8220;NO&#8221; clause in /etc/rc.conf (such as <strong>cron_enable=&#8221;NO&#8221;</strong>), or by disabling the corresponding startup script in /usr/local/etc/rc.d.</p>
<p>If you mess up a service initialization, uninstall the failed service (i.e. unlink the service&#8217;s primary service directory from /var/service), delete the &#8220;supervise&#8221; subfolders (and &#8220;down&#8221; file if present) from the service&#8217;s primary service directory (there&#8217;s one also in the &#8220;log&#8221; subfolder). Then <strong>reboot the system</strong>, and reinstall the service either by using the supervise-scripts command <strong>svc-add</strong>, or by simply symlinking the service&#8217;s primary service directory to /var/service (for example <strong>ln -s /var/db/mysql-supervise /var/service/mysql</strong>).</p>
]]></content:encoded>
			<wfw:commentRss>http://my.galagzee.com/2008/06/30/installing-daemontools-service-supervisor-on-freebsd-70/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>
