[systemd-devel] systemd TimeoutStopSec not working
mmbella
mmbella at mhtc.net
Mon Nov 4 14:59:06 UTC 2019
Hello,
I apologize if this is not the appropriate list serve to post in
however, I am having problems with a systemd service file not
terminating a python script that intermittently hangs. I have tried
other forums with no solution. The service script is listed below along
with journalctl output, timer listings and status reports. I am not
getting a specific error I can act on.
The actual python script works well for days then fails intermittently
most likely due to a hung database connection. I am not asking for
coding help with the python script only a solution to terminate the
process if it hangs.
It appears that TimeoutStopSec intermittently fails to terminate the
process. Any suggestion would be appreciated.
Thank you in advance.
Marc
-----------------
NEXT LEFT LAST PASSED
UNIT ACTIVATES
Sun 2019-11-03 06:35:31 CST 6min left Sat 2019-11-02 06:05:22 CDT
1 day 1h ago apt-daily-upgrade.timer apt-daily-upgrade.service
Sun 2019-11-03 10:12:19 CST 3h 43min left Sun 2019-11-03 04:20:18 CST
2h 8min ago apt-daily.timer apt-daily.service
Sun 2019-11-03 20:23:41 CST 13h left Sat 2019-11-02 21:23:41 CDT
10h ago systemd-tmpfiles-clean.timer systemd-tmpfiles-clean.service
Mon 2019-11-04 00:00:00 CST 17h left Sun 2019-11-03 00:00:00 CDT
7h ago logrotate.timer logrotate.service
Mon 2019-11-04 00:00:00 CST 17h left Sun 2019-11-03 00:00:00 CDT
7h ago man-db.timer man-db.service
n/a n/a Sat 2019-11-02 22:00:45 CDT
9h ago outside_air_temp_sensor.timer outside_air_temp_sensor.service
10 timers listed.
Pass --all to see loaded but inactive timers, too.
● outside_air_temp_sensor.service - Winery Outside Air Temp Sensor
Loaded: loaded (/etc/systemd/system/outside_air_temp_sensor.service;
disabled; vendor preset: enabled)
Active: activating (start) since Sat 2019-11-02 22:00:45 CDT; 9h ago
Main PID: 5274 (outside_air_tem)
Tasks: 1 (limit: 2200)
Memory: 5.7M
CGroup: /system.slice/outside_air_temp_sensor.service
└─5274 /usr/bin/python3 /home/marc/scripts/outside_air_temp.py
Nov 02 22:00:45 winerypi systemd[1]: Starting Winery Outside Air Temp
Sensor...
Nov 02 22:00:46 winerypi outside_air_temp.py[5274]: TERM environment
variable not set.
● outside_air_temp_sensor.timer - "Run the outside air temp sensor
script every few minutes and log data"
Loaded: loaded (/etc/systemd/system/outside_air_temp_sensor.timer;
enabled; vendor preset: enabled)
Active: active (running) since Fri 2019-11-01 21:07:39 CDT; 1 day
10h ago
Trigger: n/a
Nov 01 21:07:39 winerypi systemd[1]: Started "Run the outside air temp
sensor script every few minutes and log data".
-- Logs begin at Fri 2019-11-01 21:07:35 CDT, end at Sun 2019-11-03
06:30:39 CST. --
Nov 01 21:07:39 winerypi systemd[1]: Started "Run the outside air temp
sensor script every few minutes and log data".
-- Logs begin at Fri 2019-11-01 21:07:35 CDT, end at Sun 2019-11-03
06:30:45 CST. --
Nov 02 20:31:37 winerypi systemd[1]: outside_air_temp_sensor.service:
Succeeded.
Nov 02 20:31:37 winerypi systemd[1]: Started Winery Outside Air Temp Sensor.
Nov 02 21:00:27 winerypi systemd[1]: Starting Winery Outside Air Temp
Sensor...
Nov 02 21:00:27 winerypi outside_air_temp.py[5125]: TERM environment
variable not set.
Nov 02 21:00:38 winerypi systemd[1]: outside_air_temp_sensor.service:
Succeeded.
Nov 02 21:00:38 winerypi systemd[1]: Started Winery Outside Air Temp Sensor.
Nov 02 21:30:00 winerypi systemd[1]: Starting Winery Outside Air Temp
Sensor...
Nov 02 21:30:00 winerypi outside_air_temp.py[5198]: TERM environment
variable not set.
Nov 02 21:30:11 winerypi systemd[1]: outside_air_temp_sensor.service:
Succeeded.
Nov 02 21:30:11 winerypi systemd[1]: Started Winery Outside Air Temp Sensor.
Nov 02 22:00:45 winerypi systemd[1]: Starting Winery Outside Air Temp
Sensor...
Nov 02 22:00:46 winerypi outside_air_temp.py[5274]: TERM environment
variable not set.
## SERVICE FILE
[Unit]
Description=Winery Outside Air Temp Sensor
[Service]
ExecStart=/home/marc/scripts/outside_air_temp.py
Type=oneshot
User=root
Group=marc
WorkingDirectory=/home/marc/scripts
TimeoutStopSec=360
[Install]
WantedBy=multi-user.target
## TIMER FILE
[Unit]
Description="Run the outside air temp sensor script every few minutes
and log data"
[Timer]
OnCalendar=*:0,30
RandomizedDelaySec=60
Persistent=true
Unit=outside_air_temp_sensor.service
[Install]
WantedBy=multi-user.target
More information about the systemd-devel
mailing list