sysmobts: Add an option to stop the systemd sysmobts.service

For systems without direct access to the PA the best option
is to simply switch off the bts service. This will stop the
transmission which will take load from the DSP/FPGA/RF circuit
and indirectly from the PA as well.

We should introduce "pa-on and bts-on" that can be executed
as "normal" action.
This commit is contained in:
Holger Hans Peter Freyther 2014-12-12 14:53:23 +01:00
parent 8381a6a483
commit 42cc96e2c1
3 changed files with 34 additions and 0 deletions

View File

@ -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 {

View File

@ -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");
}
}
/**

View File

@ -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)