all python scripts need sigterm and sigint traps

Information

ID: 117
PHID: PHID-TASK-yravw3g3eyjzmpbt2xdc
Author: Patrick
Status at Migration Time: resolved
Priority at Migration Time: Normal

Description

Problem, when you start something like

/usr/lib/msgcollector/msgdispatcher_dispatch_x info "test title" "test msg" 1 ""

from terminal, you cannot terminate using ctrl + c. This makes it difficult for calling scripts to terminate them (in case those would receive a signal themselves) and then that process could either hang or stay open. Not critical, but an issue we can fix.

To find them.

grep -r \#\!/usr/bin/python *

What do do… I suggest this.

  • on sigterm → “Signal sigterm received! Exiting.” → exit 143
  • on sigint (ctrl + c) → “Signal sigint received! Exiting.” → exit 130

Ideally we have some small code snippet that we can easily reuse and copy and paste into all the scripts.

Comments


Patrick

2015-01-26 22:25:32 UTC


troubadour

2015-01-28 00:07:31 UTC


troubadour

2015-01-28 09:35:52 UTC


Patrick

2015-01-29 08:09:58 UTC


hqi

2015-09-03 00:15:17 UTC


Patrick

2015-09-03 11:51:35 UTC


hqi

2015-09-03 14:45:58 UTC


Patrick

2015-09-03 14:53:29 UTC


hqi

2015-09-03 23:15:58 UTC


Patrick

2015-09-03 23:17:16 UTC


joysn1980

2017-01-17 11:37:13 UTC


Patrick

2017-01-17 11:55:21 UTC


joysn1980

2017-01-17 13:09:17 UTC


Patrick

2017-01-17 15:08:39 UTC


joysn1980

2017-01-17 15:19:09 UTC


Patrick

2017-01-17 15:36:54 UTC


Patrick

2017-01-17 15:41:50 UTC


joysn1980

2017-01-18 08:07:20 UTC


joysn1980

2017-01-18 08:16:57 UTC


joysn1980

2017-01-18 08:44:34 UTC


joysn1980

2017-01-18 09:28:17 UTC


joysn1980

2017-01-18 09:28:42 UTC


Patrick

2017-01-18 11:41:43 UTC