[systemd-devel] systemd unit to launch perl script/service launches the script but doesn't exit the unit

Mantas Mikulėnas grawity at gmail.com
Sat Nov 30 12:35:03 PST 2013


On Sat, Nov 30, 2013 at 10:02 PM,  <jen142 at promessage.com> wrote:
> Hi
>
> THanks for the pointers.  Using type=simple, and removing the unneeded
> cmds, the unit for the 'smtpprox' perl daemon works exactly as expected!
>
> As a next step, I'm attempting to extend the same method that just
> worked to another perl-daemon -- the more complex 'amavisd'.
>
> @ manual launch
>
>         /usr/local/sbin/amavisd -c /usr/local/etc/amavis/amavisd.conf
>
> it works as expected; @ logs,
>
>                 2013-11-30T11:51:22.176317-08:00 newmail amavis[7130]:
>                 logging initialized, log level 5, syslog: amavis.mail
>                 2013-11-30T11:51:22.177520-08:00 newmail amavis[7130]:
>                 starting. /usr/local/sbin/amavisd at
>                 newmail.jennielan.int amavisd-new-2.7.0-pre15
>                 (20110412), Unicode aware, LANG="en_US.UTF-8"
>                 2013-11-30T11:51:22.178205-08:00 newmail amavis[7130]:
>                 perl=5.018001, user=, EUID: 65 (65);  group=, EGID: 132
>                 132 (132 132)
>                 2013-11-30T11:51:22.220790-08:00 newmail amavis[7130]:
>                 bind to /var/lib/amavis/amavisd.sock|unix,
>                 127.0.0.1:10024/tcp
>                 2013-11-30T11:51:22.229543-08:00 newmail amavis[7131]:
>                 Net::Server: Process Backgrounded
>                 ...
>                 2013-11-30T11:51:22.241323-08:00 newmail amavis[7131]:
>                 config files read: /usr/local/etc/amavis/amavisd.conf
>                 ...
>                 2013-11-30T11:51:22.315172-08:00 newmail amavis[7139]:
>                 Net::Server: Child Preforked (7139)
>                 2013-11-30T11:51:22.315970-08:00 newmail amavis[7139]:
>                 entered child_init_hook
>
>         ps ax | grep amavis
>                 7131 ?        Ss     0:00 /usr/local/sbin/amavisd
>                 (master)
>                 7138 ?        S      0:00 /usr/local/sbin/amavisd
>                 (virgin child)
>                 7139 ?        S      0:00 /usr/local/sbin/amavisd
>                 (virgin child)

amavisd goes to 'background' when started – notice these parts of the log:

> amavis[7130]: starting. /usr/local/sbin/amavisd at…
> amavis[7131]: Net::Server: Process Backgrounded
>
> 7131 ?        Ss     0:00 /usr/local/sbin/amavisd (master)

So you need to use "Type=forking" in the .service unit.

-- 
Mantas Mikulėnas <grawity at gmail.com>


More information about the systemd-devel mailing list