aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHarald Welte <laforge@gnumonks.org>2017-08-20 20:50:06 +0200
committerNeels Hofmeyr <neels@hofmeyr.de>2017-08-26 21:17:07 +0200
commit5b3f33bda9e4f0b2454c69a5184faabe520c43c7 (patch)
tree9aae1680b7d94a9fb47b91b6495f0c5f9cab4220
parent31ebc9e3afdfeb0de715a9c9cc6c040de558f7ee (diff)
Treat SIGTERM just like SIGINT in our programsnews_from_openbsc
When somebody kills the process, it's best to handle the signal and to use the opportunity for some cleanup. We always did this in the NITB on SIGINT, but never on SIGTERM. Let's change it. Change-Id: Iea6804325a6575ceab5edfd28dd20249462f143b
-rw-r--r--src/gprs/gb_proxy_main.c2
-rw-r--r--src/gprs/gtphub_main.c2
-rw-r--r--src/gprs/sgsn_main.c2
-rw-r--r--src/osmo-bsc/osmo_bsc_main.c2
-rw-r--r--src/osmo-msc/msc_main.c2
5 files changed, 10 insertions, 0 deletions
diff --git a/src/gprs/gb_proxy_main.c b/src/gprs/gb_proxy_main.c
index 69a93b6..caff27f 100644
--- a/src/gprs/gb_proxy_main.c
+++ b/src/gprs/gb_proxy_main.c
@@ -98,6 +98,7 @@ static void signal_handler(int signal)
switch (signal) {
case SIGINT:
+ case SIGTERM:
osmo_signal_dispatch(SS_L_GLOBAL, S_L_GLOBAL_SHUTDOWN, NULL);
sleep(1);
exit(0);
@@ -232,6 +233,7 @@ int main(int argc, char **argv)
msgb_talloc_ctx_init(tall_bsc_ctx, 0);
signal(SIGINT, &signal_handler);
+ signal(SIGTERM, &signal_handler);
signal(SIGABRT, &signal_handler);
signal(SIGUSR1, &signal_handler);
signal(SIGUSR2, &signal_handler);
diff --git a/src/gprs/gtphub_main.c b/src/gprs/gtphub_main.c
index 73a122c..2b87d19 100644
--- a/src/gprs/gtphub_main.c
+++ b/src/gprs/gtphub_main.c
@@ -96,6 +96,7 @@ static void signal_handler(int signal)
switch (signal) {
case SIGINT:
+ case SIGTERM:
osmo_signal_dispatch(SS_L_GLOBAL, S_L_GLOBAL_SHUTDOWN, NULL);
sleep(1);
exit(0);
@@ -302,6 +303,7 @@ int main(int argc, char **argv)
msgb_talloc_ctx_init(osmo_gtphub_ctx, 0);
signal(SIGINT, &signal_handler);
+ signal(SIGTERM, &signal_handler);
signal(SIGABRT, &signal_handler);
signal(SIGUSR1, &signal_handler);
signal(SIGUSR2, &signal_handler);
diff --git a/src/gprs/sgsn_main.c b/src/gprs/sgsn_main.c
index 71cb18c..d5d43ad 100644
--- a/src/gprs/sgsn_main.c
+++ b/src/gprs/sgsn_main.c
@@ -145,6 +145,7 @@ static void signal_handler(int signal)
switch (signal) {
case SIGINT:
+ case SIGTERM:
osmo_signal_dispatch(SS_L_GLOBAL, S_L_GLOBAL_SHUTDOWN, NULL);
sleep(1);
exit(0);
@@ -332,6 +333,7 @@ int main(int argc, char **argv)
msgb_talloc_ctx_init(tall_bsc_ctx, 0);
signal(SIGINT, &signal_handler);
+ signal(SIGTERM, &signal_handler);
signal(SIGABRT, &signal_handler);
signal(SIGUSR1, &signal_handler);
signal(SIGUSR2, &signal_handler);
diff --git a/src/osmo-bsc/osmo_bsc_main.c b/src/osmo-bsc/osmo_bsc_main.c
index ee094d6..90651b9 100644
--- a/src/osmo-bsc/osmo_bsc_main.c
+++ b/src/osmo-bsc/osmo_bsc_main.c
@@ -162,6 +162,7 @@ static void signal_handler(int signal)
switch (signal) {
case SIGINT:
+ case SIGTERM:
bsc_shutdown_net(bsc_gsmnet);
osmo_signal_dispatch(SS_L_GLOBAL, S_L_GLOBAL_SHUTDOWN, NULL);
sleep(3);
@@ -280,6 +281,7 @@ int main(int argc, char **argv)
}
signal(SIGINT, &signal_handler);
+ signal(SIGTERM, &signal_handler);
signal(SIGABRT, &signal_handler);
signal(SIGUSR1, &signal_handler);
signal(SIGUSR2, &signal_handler);
diff --git a/src/osmo-msc/msc_main.c b/src/osmo-msc/msc_main.c
index 6c62db3..723c0e6 100644
--- a/src/osmo-msc/msc_main.c
+++ b/src/osmo-msc/msc_main.c
@@ -266,6 +266,7 @@ static void signal_handler(int signal)
switch (signal) {
case SIGINT:
+ case SIGTERM:
msc_network_shutdown(msc_network);
osmo_signal_dispatch(SS_L_GLOBAL, S_L_GLOBAL_SHUTDOWN, NULL);
sleep(3);
@@ -472,6 +473,7 @@ TODO: we probably want some of the _net_ ctrl commands from bsc_base_ctrl_cmds_i
osmo_timer_schedule(&db_sync_timer, DB_SYNC_INTERVAL);
signal(SIGINT, &signal_handler);
+ signal(SIGTERM, &signal_handler);
signal(SIGABRT, &signal_handler);
signal(SIGUSR1, &signal_handler);
signal(SIGUSR2, &signal_handler);