http://gentoo-overlays.zugaina.org/funtoo/net-dns.html.en
DNS
Running apache2 under daemontools
Sunday, 21 March 2010 20:58 | ||
Prerequisite: Debian 5.0, apache2
mkdir -m 1755 /var/service/apache2
chmod 755 run Stop the startup script: The following commands will create the symbolic links needed to start the service. ln -s /var/service/apache2 /service/ |
Running tomcat under daemontools
Friday, 29 January 2010 13:33 | |
There are no translations available.
Prerequisite: tomcat6 Adding system users: useradd tomcat -g nogroup -d /java/tomcat6/ -s /bin/false -p’*’ -r Change the ownership of the directories for running tomcat as unpriviledged user, tomcat: Creating directories mkdir -p /var/service/ #!/bin/sh chmod 755 run #!/bin/sh /etc/init.d/tomcat stop ln -s /var/service/tomcat /service/tomcat |
Running Postfix From Daemontools
NOTE: all links in this document refer to external sites which are beyond my control. The documents linked retain the copyright of their respective authors. I disclaim all liabilites for the content presented on the other sites.
Introduction
Postfix is a modular, high-performance and relatively secure mail transport agent for Unix written and maintained by Wietse Z. Venema. It is aimed as replacement for sendmail and tries to mimic its user-visible behaviour closely.
Daemontools is a collection of tiny useful tools that monitor and manage services (daemons) written by Daniel J. Bernstein. If you’re familiar with SysV init and inittab, daemontools do a similar job, but do not have a notion of run levels, but are purely service oriented.
Postfix is usually run from your system startup files, either from a rc file (BSD, some Linux variants) or via SysV-style init (SysV and some other Linux variants). Although Postfix’ master process has proven reliable on a couple of machines in over two years’ time, you may want to start Postfix from daemontools.
Setting up a/servicedirectory entry for Postfix
I’m assuming that you have already installed daemontools as written in Dan’s document. Make sure svscan is started properly at reboot time and it is running before you do the following.
Then, to start Postfix from daemontools, do the following:
- Create a directory where you want your run file in. Example:
1mkdir /etc/postfix/service - Create a file /etc/postfix/service/runwhich contains the following (you may want to adjust the PATH to your local needs):
1234567891011121314151617181920#! /bin/shset -ePATH=/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbinexport PATH# guess path for command_directorycommand_directory=`postconf -h command_directory`daemon_directory=`$command_directory/postconf -h daemon_directory`# kill Postfix if running$daemon_directory/master -t || $command_directory/postfix stop# make consistency check$command_directory/postfix check >/dev/console 2>&1# run Postfixexec $daemon_directory/masterexit $? - Make this script executable:
1chmod 755 /etc/postfix/service/run - Make a symlink into /service:
1ln -s /etc/postfix/service /service/postfix
Notes
- If postfix has been started outside of daemontools, postfix stop is invoked before postfix is started. This makes sure you can control Postfix with svc. It may however interrupt service for a couple of seconds.
- svscan will start Postfix in a few seconds’ time.
- You cannotusepostfix stop,postfix drainandpostfix startto manage Postfix. In case you stop Postfix this way, daemontools will think Postfix has crashed and restart it. If you start Postfix this way, it will either be refused because svscan already started Postfix or, if svscan is started later, supervise will loop and Postfix is not supervised. Also see below.
- You canusepostfix flushandpostfix checkalthough the latter is done automatically before startup as well.
- You canusepostfix reloadsafely.
- To stopPostfix, use:svc -d /service/postfixmnemonic: -d for down
- To startPostfix, use:svc -u /service/postfixmnemonic: -u for up
http://webdesignledger.com/wp-content/uploads/2010/02/workstations_15.jpg
I know there are others, but this is mine.  I always forget how-to change the default installation path with his software, until of course it’s too late and then I get to re-do it.
Need daemontools, ucspi-tcp, and djbdns source code.
Create a working directory
$ mkdir ~/working && cd ~/working
Grab src code
$ wget http://cr.yp.to/djbdns/djbdns-1.05.tar.gz
$ wget http://cr.yp.to/daemontools/daemontools-0.76.tar.gz
$ wget http://cr.yp.to/ucspi-tcp/ucspi-tcp-0.88.tar.gz
1). First install daemontools, now if you have never installed anything from David Bernstein, his approach, may seem a little different than what you are normally used to with ./configure; make; make install. There might be a easy approach to moving this somewhere else but I have found that when I do..it sometimes comes back to bite me. So for daemontools, I leave it defaulted even thought it still drives me nuts everytime..
Create a /package directory:
1 2 3 |
$ sudo mkdir -p /package $ sudo chmod 1755 /package $ cd /package |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
$ sudo cp ~/working/daemontools-0.76.tar.gz . $ sudo tar -xvzfdaemontools-0.76.tar.gz $ sudo rm -f daemontools-0.76.tar.gz (or just leave it, this step is optional) $ cd admin/daemontools-0.76 If your installing this on a Linux host, then you need to fix do the following with the conf-cc file. However, if your on a BSD host, you can skip and just skip to package/install $ cd src $ sudo echo gcc -O2 -include /usr/include/errno.h > conf-cc $ cd ../../ $ sudo package/install If you are successful on this, the author would like to know about it. Run the following and you satisfy his request. $ mail djb-sysdeps@cr.yp.to < /package/admin/daemontools/compile/sysdeps Done. <strong>Ucspi-tcp</strong> Next, need to install ucspi-tcp $ cd ~/working $ sudo tar -xczf ucspi-tcp-0.88.tar.gz $ cd ucspi-tcp-0.88 Need to fix the conf-cc file if on Linux. $ sudo echo gcc -O2 -include /usr/include/errno.h > conf-cc If you would like to change the default home (--prefix=) then you need to update the conf-home file. (Default installs into /usr/local) $ sudo vi conf-home $ make $ sudo make setup check |
1 |
If you are successful on this, the author would like to know about it. Run the following and you satisfy his request. |
1 2 3 4 |
( echo 'First M. Last'; cat `cat SYSDEPS` ) \ | mail djb-sysdeps@cr.yp.to Replace <tt>First M. Last</tt> with your name. |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
Done. Finally, install djbdns $ cd ~/working $ tar -xvzf djbdns-1.05.tar.gz Going to stop right here, as you may need to patch. While although secure, TinyDNS does not have everything built into it. Others have added functionality. Â I know I needed to compile in a fix for the 512bytes UDP packet payload for axfrdns, we would get truncated info for some of our domains and SRV support. I will later put up some links for patches. For now I will be installing just one patch, it's basically 13 patches rolled into one. <a href="http://ohse.de/uwe/patches.html">http://ohse.de/uwe/patches.html</a> Here's the one I will be installing now. <a href="http://jeremy.kister.net/code/djbdns-1.05.isp.patch">http://jeremy.kister.net/code/djbdns-1.05.isp.patch</a> $ sudo patch -d djbdns-1.05 < djbdns-1.05.isp.patch patching file Makefile patching file axfr-get.c patching file axfrdns.c patching file cache.c patching file dns.h patching file dns_rotateip.c patching file dns_transmit.c patching file dnscache.c patching file dnsroots.global patching file error.h patching file query.c patching file response.c patching file server.c patching file tdlookup.c patching file tdlookup.h patching file tinydns-data.c patching file tinydns-get.c patching file tinydns.c $ cd djbdns-1.05 Â $ sudo echo gcc -O2 -include /usr/include/errno.h > conf-cc $ sudo conf-home (If you want to change the install path) $ sudo make $ sudo make setup check Report success: |
1 2 |
( echo 'First M. Last'; cat `cat SYSDEPS` ) \ | mail djb-sysdeps@cr.yp.to |
1 2 3 |
Replace <tt>First M. Last</tt> with your name. Done. |