You are not logged in.

#1 2015-10-21 01:23:49

amw2320
Member
Registered: 2005-08-14
Posts: 30

[Solved] systemd closing ppp before ip-down scripts run

I am having an issue of cleaning up after my ppp connection as my routing is not reset. I have traced it back to the ip-down scripts not being run when using a systemd service to control the ppp connection.

When I run pon and poff from the command line, I get a graceful shutdown

Oct 20 18:12:47 MiniServer pppd[3965]: Terminating on signal 15
Oct 20 18:12:47 MiniServer sstpc[3966]: Terminating on Terminated (15)
Oct 20 18:12:47 MiniServer pppd[3965]: Connect time 0.7 minutes.
Oct 20 18:12:47 MiniServer pppd[3965]: Sent 988 bytes, received 7562 bytes.
Oct 20 18:12:47 MiniServer sudo[3990]: pam_unix(sudo:session): session closed for user root
Oct 20 18:12:47 MiniServer pppd[3965]: Script /etc/ppp/ip-down started (pid 3997)
Oct 20 18:12:47 MiniServer pppd[3965]: MPPE disabled
Oct 20 18:12:47 MiniServer pppd[3965]: sent [LCP TermReq id=0x2 "MPPE disabled"]
Oct 20 18:12:47 MiniServer pppd[3965]: sent [LCP TermReq id=0x3 "MPPE disabled"]
Oct 20 18:12:47 MiniServer pppd[3965]: Script sstpc --ipparam sstp-purevpn --cert-warn --nolaunchpppd de1-sstp.pointtoserver.com finished (pid 3966), status = 0x0
Oct 20 18:12:47 MiniServer pppd[3965]: Modem hangup
Oct 20 18:12:47 MiniServer pppd[3965]: Connection terminated.
Oct 20 18:12:47 MiniServer pppd[3965]: Waiting for 1 child processes...
Oct 20 18:12:47 MiniServer pppd[3965]:   script /etc/ppp/ip-down, pid 3997
Oct 20 18:12:47 MiniServer pppd[3965]: Script /etc/ppp/ip-down finished (pid 3997), status = 0x0
Oct 20 18:12:47 MiniServer pppd[3965]: Exit.

However when I run this as a systemd service, I get:

Oct 19 16:13:11 MiniServer pppd[592]: Terminating on signal 15
Oct 19 16:13:11 MiniServer sstpc[593]: Terminating on Terminated (15)
Oct 19 16:13:11 MiniServer pppd[592]: Connect time 2.2 minutes.
Oct 19 16:13:11 MiniServer pppd[592]: Sent 2424 bytes, received 13076 bytes.
Oct 19 16:13:11 MiniServer pppd[592]: Script /etc/ppp/ip-down started (pid 626)
Oct 19 16:13:11 MiniServer pppd[592]: MPPE disabled
Oct 19 16:13:11 MiniServer pppd[592]: sent [LCP TermReq id=0x2 "MPPE disabled"]
Oct 19 16:13:11 MiniServer pppd[592]: sent [LCP TermReq id=0x3 "MPPE disabled"]
Oct 19 16:13:11 MiniServer pppd[592]: Script sstpc --ipparam sstp-purevpn --cert-warn --nolaunchpppd de1-sstp.pointtoserver.com finished (pid 593), status = 0x0
Oct 19 16:13:11 MiniServer pppd[592]: Modem hangup
Oct 19 16:13:11 MiniServer pppd[592]: Connection terminated.
Oct 19 16:13:11 MiniServer pppd[592]: Child process /etc/ppp/ip-down (pid 626) terminated with signal 15
Oct 19 16:13:12 MiniServer pppd[592]: Exit.
Oct 19 16:13:12 MiniServer systemd[1]: purevpn.service: Main process exited, code=exited, status=16/n/a
Oct 19 16:13:12 MiniServer systemd[1]: Stopped PureVPN service.
Oct 19 16:13:12 MiniServer systemd[1]: purevpn.service: Unit entered failed state.
Oct 19 16:13:12 MiniServer systemd[1]: purevpn.service: Failed with result 'exit-code'.

My service file is:

[Unit]
Description=PureVPN service
Requires=VPNonly.service

[Service]
Type=forking
ExecStart=/usr/bin/pon sstp-purevpn
ExecStop=/usr/bin/poff
Restart=always

[Install]
WantedBy=multi-user.target 

Is there a way to tell systemd to slow down and let my scripts finish before sending a sigterm?

Last edited by amw2320 (2015-10-21 01:34:59)

Offline

#2 2015-10-21 01:34:45

amw2320
Member
Registered: 2005-08-14
Posts: 30

Re: [Solved] systemd closing ppp before ip-down scripts run

Ahhh, figured it out, I'll leave up for anyone else searching.

Added KillMode=none to the service section of the service file

Offline

Board footer

Powered by FluxBB