[systemd-devel] systemd and smartd daemon

Lennart Poettering lennart at poettering.net
Fri Apr 3 04:17:05 PDT 2015


On Thu, 02.04.15 11:49, Al Lau (lauatic at gmail.com) wrote:

> As a test, the "/usr/sbin/smartd $smartd_opts" is invoked from the command
> line and the daemon is forked and stayed up as expected.  By default, the
> /usr/sbin/smartd daemonize.

Well, but does it do that correctly? i.e. does it *double* fork, not
just once? Does it write the PID file *before* exiting in the parent?

> # cat /etc/sysconfig/smartmontools
> smartd_opts="--interval=3600 --configfile=/etc/smartd.conf"
> 
> >From the /var/log/messages, the SIGTERM signal is sent to the forked
> process.  Like to know if this is something that can be worked around.

Well, systemd sends SIGTERM to all processes of a service when it
shuts them down. As mentioned before: smartd probably doesn't properly
demonize, it most likely writes the PID file too late. And when
systemd then realizes that smartd doesn't operate properly it will
shut it down again and put it in a filure state, and that's what you
are seeing.

Again: most likely smartd is broken, needs to fix its daemonization
code.

Lennart

-- 
Lennart Poettering, Red Hat


More information about the systemd-devel mailing list