diff options
-rw-r--r-- | src/osmo-bts-sysmo/misc/sysmobts_mgr.h | 1 | ||||
-rw-r--r-- | src/osmo-bts-sysmo/misc/sysmobts_mgr_temp.c | 11 | ||||
-rw-r--r-- | src/osmo-bts-sysmo/misc/sysmobts_mgr_vty.c | 22 |
3 files changed, 34 insertions, 0 deletions
diff --git a/src/osmo-bts-sysmo/misc/sysmobts_mgr.h b/src/osmo-bts-sysmo/misc/sysmobts_mgr.h index fd6f2bcb..f4058674 100644 --- a/src/osmo-bts-sysmo/misc/sysmobts_mgr.h +++ b/src/osmo-bts-sysmo/misc/sysmobts_mgr.h @@ -16,6 +16,7 @@ enum { TEMP_ACT_MASTER_OFF = 0x2, TEMP_ACT_SLAVE_OFF = 0x4, TEMP_ACT_PA_OFF = 0x8, + TEMP_ACT_BTS_SRV_OFF = 0x10, }; enum sysmobts_temp_state { diff --git a/src/osmo-bts-sysmo/misc/sysmobts_mgr_temp.c b/src/osmo-bts-sysmo/misc/sysmobts_mgr_temp.c index d110c131..c757f63a 100644 --- a/src/osmo-bts-sysmo/misc/sysmobts_mgr_temp.c +++ b/src/osmo-bts-sysmo/misc/sysmobts_mgr_temp.c @@ -98,6 +98,17 @@ static void handle_actions(int actions) * requires the control protocol. */ } + + if (actions & TEMP_ACT_BTS_SRV_OFF) { + LOGP(DTEMP, LOGL_NOTICE, + "Going to switch off the BTS service\n"); + /* + * TODO: use/create something like nspawn that serializes + * and used SIGCHLD/waitpid to pick up the dead processes + * without invoking shell. + */ + system("/bin/systemctl stop sysmobts.service"); + } } /** diff --git a/src/osmo-bts-sysmo/misc/sysmobts_mgr_vty.c b/src/osmo-bts-sysmo/misc/sysmobts_mgr_vty.c index 9c8b15b3..5c75840e 100644 --- a/src/osmo-bts-sysmo/misc/sysmobts_mgr_vty.c +++ b/src/osmo-bts-sysmo/misc/sysmobts_mgr_vty.c @@ -170,6 +170,8 @@ static void write_action(struct vty *vty, const char *name, int actions) #endif vty_out(vty, " %spa-off%s", (actions & TEMP_ACT_PA_OFF) ? "" : "no ", VTY_NEWLINE); + vty_out(vty, " %sbts-service-off%s", + (actions & TEMP_ACT_BTS_SRV_OFF) ? "" : "no ", VTY_NEWLINE); } static int config_write_mgr(struct vty *vty) @@ -257,6 +259,24 @@ DEFUN(cfg_no_action_pa_off, cfg_no_action_pa_off_cmd, return CMD_SUCCESS; } +DEFUN(cfg_action_bts_srv_off, cfg_action_bts_srv_off_cmd, + "bts-service-off", + "Stop the systemd sysmobts.service\n") +{ + int *action = vty->index; + *action |= TEMP_ACT_BTS_SRV_OFF; + return CMD_SUCCESS; +} + +DEFUN(cfg_no_action_bts_srv_off, cfg_no_action_bts_srv_off_cmd, + "no bts-service-off", + NO_STR "Stop the systemd sysmobts.service\n") +{ + int *action = vty->index; + *action &= ~TEMP_ACT_BTS_SRV_OFF; + return CMD_SUCCESS; +} + DEFUN(show_mgr, show_mgr_cmd, "show manager", SHOW_STR "Display information about the manager") { @@ -327,6 +347,8 @@ static void register_action(int act) #endif install_element(act, &cfg_action_pa_off_cmd); install_element(act, &cfg_no_action_pa_off_cmd); + install_element(act, &cfg_action_bts_srv_off_cmd); + install_element(act, &cfg_no_action_bts_srv_off_cmd); } int sysmobts_mgr_vty_init(void) |