- More info here:http://cr.yp.to/daemontools.html
- Original author: D.J. Bernstein
- github
- version: 0.79
daemontools
is a collection of tools for managingUNIX
services. It monitorsqmail
services and saves error messages to one or more logs.
Changelog
- Version 0.79
This version does not add new features nor corrects bugs. It's just a reorganizations of the files in the source dir
- daemontools will be installed in /var/qmail/daemontools
- Moved 'package' and 'src' to the top dir
- Version grabbed from 'VERSION' in package/upgrade - Feb 9, 2025 (v0.78.4)
- several adjustments to get clang version 18.1.6 compatibility
- restored !/bin/sh in all scripts - Dec 9, 2023
- moved my patched daemontools to github and named 0.77 the new version
- clear service moved to qmail/supervise/clear
multilog
program with human readable datetime
multilog
program has been modified to work both with timestamps and human readable datetimes (commit).The actiont
inserts an @, a precise timestamp, and a space in front of each line, using the same format astai64n
.
Example:
multilogt '-*' '+* fatal: *' ./main
prints the line
@400000003b4a39c23294b13c fatal: out of memory
The actiond
inserts a human readable datetime in front of each line and a space.
Example:
multilogd '-*' '+* fatal: *' ./main
prints the line
2024-07-29 10:36:08.811661123 fatal: out of memory
Both flags are required to be the first action.
Other patches applied
Thedaemontools
that we are going to install contains the following patches to the original djbdaemontools-0.76
:
errno
patchThe
multilog_filesize_limit
patch (thanks to Sam Tang), which extends the file log size limit to 100MB (default is 16MB)
Installation
First of all, let's create the directory/var/qmail which will hostqmail
,daemontools
anducspi-tcp.
mkdir -p /var/qmail
Installdaemontools
:
DAEMONTOOLS_VER=0.79cd /var/qmailwget https://github.com/sagredo-dev/daemontools/archive/refs/tags/v${DAEMONTOOLS_VER}.tar.gztar xzf v${DAEMONTOOLS_VER}.tar.gzcd daemontools-${DAEMONTOOLS_VER}chown -R root:root .package/install
So we havedaemontools
in/var/qmail/daemontools.
If you get the following error while linking tolibrt.so (I got it onOpenBSD 7.6
)
ld: error: unable to find library -ltr
you have to change the first line insrc/conf-ld, simply deleting "-ltr
":
cc -s
clear
servive
The"clear" service can easily clear thereadproctitle service errors
line. We'll configure it later.
Runningdaemontools
at boot time
The method to start thedaemontools
services depends of your OS. If your system boot is handled by/etc/inittab,/command/svscanboot has been added in your/etc/inittab at the time of thedaemontools
installation and you don't have to do anything else, as it will be sufficient to runqmail
at boot time.
Onsystemd
based OS the above command has to be added torc.local in order to be executed at boot time, supposing thatrc.local itself is executed at boot time.
As an alternative to this, you can choose to create a specificdaemontools.service
as follows:
cat > /etc/systemd/system/daemontools.service << __EOF__[Unit]Description=Daemontools service supervisionConditionPathExists=/command/svscanboot[Service]ExecStart=/command/svscanbootRestart=always[Install]WantedBy=multi-user.target__EOF__systemctl enable daemontools.servicesystemctl start daemontools.service
Be aware that in this way you are not allowed to useqmailctl
anymore, but you have to start/stopqmail
via systemd
.
systemdctl start/stop daemontools
If you try to startqmail
via qmailctl
, having asystemd
service active and started, you'll have twodaemontools
runningqmail
and the following error on thereadproctitle service errors
line:
135277 ? S 0:00 \_ readproctitle service errors: ...fatal: unable to acquire vusaged/supervise/lock: temporary failure supervise: fatal: unable to acquire qmail-submission/supervise/lock: temporary failure supervise: fatal: unable to acquire vusaged/supervise/lock: temporary failure supervise: fatal: unable to acquire qmail-submission/supervise/lock: temporary failure supervise: fatal: unable to acquire vusaged/supervise/lock: temporary failure
This guide will refer toqmailctl
in all the examples whereqmail
has to be started or stopped.
Comments
daemontools - package/install
Ivelin TopalovOctober 13, 2024 23:03 CET
daemontools - package/install - puts in rc.local : csh /command/svcscanboot & but the rc.local is driven by bash and csh is not installed by default on ubuntu - so it fails
daemontools - package/install
Roberto PuzzangheraIvelin TopalovOctober 14, 2024 17:31 CET
thanks for the hint. Solved in v. 0.78.3
Error while installing daemontools
Shailendra ShuklaOctober 8, 2024 07:13 CET
HI Roberto,
I am facing issue while package/install of daemontools on RHEL6/CentOS6 and below is the error message
./compile timestamp.c
./load multilog deepsleep.o timestamp.o match.o time.a unix.a byte.a
timestamp.o: In function `readable_datetime':
timestamp.c:(.text+0xc): undefined reference to `clock_gettime'
collect2: ld returned 1 exit status
make: *** [multilog] Error 1
Regards
Shailendra
Error while installing daemontools
Roberto PuzzangheraShailendra ShuklaOctober 8, 2024 10:50 CET
Hi Shailendra,
that clock_gettime function is in the time.h file of the glibc library. Probably it is not linked to the timestamp.c program. Which glibc version do you have? (ldd --version)
Can you modify the src/conf-cc file like this
-gcc -O2
+gcc -lrt -O2
and run package/install again?
Anyway you can solve installing the original daemontools-0.76 patched with theerrno.patch, but please let me know if the above test works for centos 6.10
Error while installing daemontools
Shailendra ShuklaRoberto PuzzangheraOctober 8, 2024 12:18 CET
Hi Roberto,
Tried the hack that you suggested but still getting the same error
./compile timestamp.c
./load multilog deepsleep.o timestamp.o match.o time.a unix.a byte.a
timestamp.o: In function `readable_datetime':
timestamp.c:(.text+0xc): undefined reference to `clock_gettime'
collect2: ld returned 1 exit status
make: *** [multilog] Error 1
Kindly find the output of ldd --version
ldd (GNU libc) 2.12
Copyright (C) 2010 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Written by Roland McGrath and Ulrich Drepper.
As suggested by you I tried with daemontools 0.76 and I get the following error
./load envdir unix.a byte.a
/usr/bin/ld: errno: TLS definition in /lib64/libc.so.6 section .tbss mismatches non-TLS reference in envdir.o
/lib64/libc.so.6: could not read symbols: Bad value
collect2: ld returned 1 exit status
make: *** [envdir] Error 1
Regards
Shailendra
Error while installing daemontools
Roberto PuzzangheraShailendra ShuklaOctober 8, 2024 12:54 CET
Sorry for the wrong suggestion I gave before. Use conf-cc and conf-ld like these
conf-cc with no modifications, so
gcc -O2
add -lrt to conf-ld
gcc -s -lrt
I don't know what's going on for version 0.76
Error while installing daemontools
Shailendra ShuklaRoberto PuzzangheraOctober 9, 2024 07:52 CET
Hi Roberto,
As per your suggesstion modifying the conf-ld with gcc -s -lrt did the trick and I was able to successfully install daemontools 0.78.1 on RHEL6/Centos6.
Thanks for your help
Regards
Shailedra
daemontools-0.78
Nigel PillaySeptember 5, 2024 10:26 CET
Hello Roberto
Is package/compile script missing from daemontools-0.78 source package?
BTW thanks for all the great work you and others are doing to keep qmail alive.
daemontools-0.78
Roberto PuzzangheraNigel PillaySeptember 5, 2024 10:36 CET
Unfortunately it is missing. I'm out of home now. I'll correct the problem tomorrow.
In the meantime you can replace that script with one of a previous version
daemontools-0.78
Nigel PillayRoberto PuzzangheraSeptember 5, 2024 11:14 CET
Many thanks Roberto and my heartfelt appreciation for the incredible work your are doing.
daemontools-0.78
Roberto PuzzangheraNigel PillaySeptember 6, 2024 18:16 CET
I've rebuilt the 0.78 package with the package/compile script.
Thanks for the advice!
daemontools-0.78
Bai BorkoRoberto PuzzangheraOctober 4, 2024 12:45 CET
Hi Roberto,
package/compile script still missing in daemontools-0.78 source?
daemontools-0.78
Roberto PuzzangheraBai BorkoOctober 4, 2024 13:00 CET
Tx Bai, I've created 0.78.1 with that file added
correction
Ivelin TopalovMarch 7, 2024 20:37 CET
cd daemontools-${DAEMONTOOLS_VER}
this line also has same 3 hidden chars 9see in hex)
correction
Ivelin TopalovMarch 7, 2024 20:33 CET
cp -rp ${SRC}/daemontools-${DAEMONTOOLS_VER}/admin/daemontools-${DAEMONTOOLS_VER} .
this line somehow has 3 hidden bytes (copy it and look in hex) which makes it wrong
suggestion to insert install of build-essentials etc on this page.
GoofYMarch 4, 2023 09:06 CET
is it an idea to put the following already here instead of on page installing and configuring vpopmail?:
apt install build-essential autoconf automake libmariadb-dev libmariadb-dev-compat
suggestion to insert install of build-essentials etc on this page.
Roberto PuzzangheraGoofYMarch 4, 2023 19:55 CET
I created a page with the preinstallation tasks, where this and other preliminary tasks are covered. Feel free to post other hints
suggestion to insert install of build-essentials etc on this page.
Roberto PuzzangheraGoofYMarch 4, 2023 09:09 CET
ok, inserted
make: not found
ThuanMarch 5, 2020 04:18 CET
Hi everybody .
i had a problem need your help :
- when i run a command line :
# package/install
i see :
Linking ./src/* into ./compile...
Compiling everything in ./compile...
package/compile: 20: exec: make: not found .
help me , pls .
thanks.
make: not found
Roberto PuzzangheraThuanMarch 5, 2020 07:56 CET
I think that you should install autotools. Please refer to your distribution's documentation for the purpose
attribute eXecute to "run" file
Marco VarandaFebruary 16, 2020 14:43 CET
Hello,
I´m doing a procedure to install qmail to CentOS 8 (systemd)
run file gets 644 attribute, should we change to 744 ?
Thanks for your work !
Marco Varanda
Supervise not running on debian
JmecherieAugust 24, 2019 07:45 CET
If you receive error: Error supervise not running
It's because daemontools/svscanboot is not starting from sysvinit inittab.
To start from systemd:
cat > /lib/systemd/system/daemontools.service << __EOF__
[Unit]
Description=Daemontools service supervision
[Service]
ExecStart=/command/svscanboot /etc/service/
Restart=always
[Install]
WantedBy=multi-user.target
__EOF__
systemctl enable daemontools.service
systemctl status daemontools
Broken link
Gabriel TorresJune 19, 2019 00:31 CET
qmail.org is offline, change:
wget http://www.qmail.org/netqmail-1.06.tar.gz
to
wget https://notes.sagredo.eu/files/qmail/tar/netqmail-1.06.tar.gz
patch of multilog file size limit
Sam TangApril 6, 2018 11:35 CET
Hi,
This is the little multilog patch I would like to share.
By default multilog only support max 16MB log file, for my email server, 16MB only can save 5 hours log, so I made this little patch, and change multilog file limit to 100MB, here how to apply:
cd /usr/local/src
wget https://www.phpini.com/files/multilog_filesize_limit.patch
cd /var/qmail/admin/daemontools
patch -p1 < /usr/local/src/multilog_filesize_limit.patch
package/install
and then update log/run file/s, now can assign file size to s104857600 (100MB).
patch of multilog file size limit
Roberto PuzzangheraSam TangApril 6, 2018 19:55 CET
thank you, Sam.. I'll add it asap
patch of multilog file size limit
casey workmanRoberto PuzzangheraJune 24, 2024 17:09 CET
I have recently installed qmail from all the great information here (thanks for this). But after reviewing my log files they are all 16M and rotate out after the 10th one (current log and then 9 of the renamed @.....#.s files). So I did check the multilog.c file from the patch just to confirm and everything looks good there. But it is still cutting the logs out at 16M instead of 100M. How do I go about figuring out where to change that value and maybe even increase the number of logs it keeps?
patch of multilog file size limit
Roberto Puzzangheracasey workmanJune 24, 2024 17:20 CET
in the log run file you have something like this
exec /usr/local/bin/setuidgid $LOGUSER /usr/local/bin/multilog t n5 s16777215 $LOGDIR \
where n5 is the number of log files and s16777215 is the maximum size in bytes. Look here for more infohttp://cr.yp.to/daemontools/multilog.html
clear service
Ivelin TopalovFebruary 6, 2018 10:17 CET
the creation of clear service is non understandeable and not well described
cat > clear/run <
syntax error near unexpected token `newline'
what must do run to clear ?
no link creation for service clear
But how do you set the PATH so daemontools can run properly?
Dave MartinMarch 10, 2012 20:04 CET
I tried installing daemontools exactly as outlined above. But qmailctl start fails because it can't find svc, svok, etc. I researched on the web, and it appears that the issue is with daemontools not being found in the PATH. I've tried updating the path in /etc/profile, and in /etc/inittab (when launching svscan). Although ps -ef | grep svscan demonstrates that svscan is running, qmailctl can't seem to find scripts in the /command folder.
(Per your suggestion, I'm trying to do this install on Slackware (version 13.37).)
I also tried running ./rts > rts.out (as mentioned in Dave Sill's book, "Life With Qmail") but it bombs on every line--again complaining 'command not found' one line after the next.
What am I doing wrong?
Thanks in advance for your response.
-Dave Martin
Hi Dave, first of all thanks
roberto puzzangheraDave MartinMarch 10, 2012 20:55 CET
Hi Dave, first of all thanks a lot for your support.
You should have this PATH inside the/command/svscanboot script:
PATH=/command:/usr/local/bin:/usr/local/sbin:/bin:/sbin:/usr/bin:/usr/sbin:/usr/X11R6/bin
qmail should start by means of a line inside/etc/inittab
SV:123456:respawn:/command/svscanboot
so, you may want to check thatsvscanboot was actually launched on boot, or try to run it manually. I prefer to have it in myrc.local
fyi, I have tested everything on a slackware64 13.37
cheers :)
Roberto
Daemantools with systemd
hifsroberto puzzangheraJanuary 11, 2014 14:38 CET
if your linux using systemd
remove SV:123456:repawn:/command/svscanboot from /etc/inittab
create a file at /lib/systemd/system/daemontools.service
edit as
[Unit]
Description=DJB daemontools
After=syslog.target network.target
[Service]
ExecStart=/command/svscanboot
Restart=always
[Install]
WantedBy=multi-user.target
copy links
ln -s /lib/systemd/system/daemontools.service /etc/systemd/system/multi-user.target.wants
reboot ur system
I confirmed the settings you gave, but still not working
Dave Martinroberto puzzangheraMarch 12, 2012 12:15 CET
qmailctl start continues to return errors on line 17: svok: command not found
However, ps -ef | grep svscan returns the following:
root 1886 1 0 Mar10 ? 00:00:00 /bin/sh /command/svscanboot
root 1948 1886 0 Mar10 ? 00:00:02 svscan /service
root 9379 6093 0 01:12 pts/0 00:00:00 grep svscan
Could there be a permissions issue with the qmail user accounts? Does the qmail group need to be granted permission to in order to run the daemontool utilities?
It's seems like the
roberto puzzangheraDave MartinMarch 12, 2012 13:51 CET
It's seems like thedaemontools' installation has failed... can you post please:
ls -l /command/ps axfuww
anyway feel free to contact me in private using the contact button above