[systemd-devel] systemd unit to launch perl script/service launches the script but doesn't exit the unit
jen142 at promessage.com
jen142 at promessage.com
Fri Nov 29 12:03:33 PST 2013
I'm trying to launch a perl service using systemd.
The perl script is 'smtpprox'
(https://github.com/jnorell/smtpprox/blob/master/smtpprox)
The unit file I created is
cat /etc/systemd/system/smtpprox.service
[Unit]
Description=smtpprox
Requires=var-run.mount
After=var-run.mount
[Service]
Type=oneshot
KeepAfterExit=true
PrivateTmp=false
ExecStart=/usr/local/etc/postfix/filters/smtpprox
127.0.0.1:10025 127.0.0.1:10026
ExecStop=kill `pidof perl`
[Install]
WantedBy=multi-user.target
When I exec
systemctl daemon-reload
systemctl start smtpprox.service
It does start the service
ps ax | grep smtpprox
10835 pts/2 S+ 0:00 systemctl start
smtpprox-custom.service
10837 ? Ss 0:00 /usr/bin/perl -w
/usr/local/etc/postfix/filters/smtpprox --children=4
127.0.0.1:10025 127.0.0.1:10026
10838 ? S 0:00 /usr/bin/perl -w
/usr/local/etc/postfix/filters/smtpprox --children=4
127.0.0.1:10025 127.0.0.1:10026
10839 ? S 0:00 /usr/bin/perl -w
/usr/local/etc/postfix/filters/smtpprox --children=4
127.0.0.1:10025 127.0.0.1:10026
10840 ? S 0:00 /usr/bin/perl -w
/usr/local/etc/postfix/filters/smtpprox --children=4
127.0.0.1:10025 127.0.0.1:10026
10841 ? S 0:00 /usr/bin/perl -w
/usr/local/etc/postfix/filters/smtpprox --children=4
127.0.0.1:10025 127.0.0.1:10026
but never exits/releases at shell
systemctl start smtpprox-custom.service
( ... just sits here ... )
How do I get the unit to exec that script, leave the script running, and
exit the properly?
Also, the
ExecStop=kill `pidof perl`
works, but kills ALL running perl scripts/jobs -- not just the smtpprox
parent/children.
What's the right way to get systemd to find/kill only the pids related
to smtpprox?
JenL
More information about the systemd-devel
mailing list