From 114293a414bd5b7c86622ec8c293c4034c80d243 Mon Sep 17 00:00:00 2001 From: Max Date: Wed, 14 Jun 2017 15:19:06 +0200 Subject: Copy sysmobts.service to osmo-bts-sysmo This way the name of systemd service file will match the name of the binary similar to lc15. Add aliases so the user can use both old and new names regardless of which file is installed. Once the corresponding changes to OE recipes are applied old file can be removed. Based on work by Pau Espin Pedrol Change-Id: I08615eb625d488603aeb5962ad9f30869c0e77c5 --- Makefile.am | 2 +- contrib/osmo-bts-sysmo.service | 20 ++++++++++++++++++++ contrib/sysmobts.service | 1 + src/osmo-bts-sysmo/misc/sysmobts_mgr_temp.c | 4 ++-- src/osmo-bts-sysmo/misc/sysmobts_mgr_vty.c | 8 ++++---- 5 files changed, 28 insertions(+), 7 deletions(-) create mode 100644 contrib/osmo-bts-sysmo.service diff --git a/Makefile.am b/Makefile.am index 9a5e26f0..5598c4aa 100644 --- a/Makefile.am +++ b/Makefile.am @@ -5,7 +5,7 @@ SUBDIRS = include src tests # package the contrib and doc EXTRA_DIST = \ - contrib/dump_docs.py contrib/screenrc-l1fwd contrib/sysmobts.service \ + contrib/dump_docs.py contrib/screenrc-l1fwd contrib/osmo-bts-sysmo.service \ contrib/l1fwd.init contrib/screenrc-sysmobts contrib/respawn.sh \ contrib/sysmobts.init contrib/sysmobts-calib/Makefile \ contrib/sysmobts-calib/sysmobts-calib.c \ diff --git a/contrib/osmo-bts-sysmo.service b/contrib/osmo-bts-sysmo.service new file mode 100644 index 00000000..bbb2beff --- /dev/null +++ b/contrib/osmo-bts-sysmo.service @@ -0,0 +1,20 @@ +[Unit] +Description=sysmocom sysmoBTS + +[Service] +Type=simple +ExecStartPre=/bin/sh -c 'echo 0 > /sys/class/leds/activity_led/brightness' +ExecStart=/usr/bin/osmo-bts-sysmo -s -c /etc/osmocom/osmo-bts.cfg -M +ExecStopPost=/bin/sh -c 'echo 0 > /sys/class/leds/activity_led/brightness' +ExecStopPost=/bin/sh -c 'cat /lib/firmware/sysmobts-v?.bit > /dev/fpgadl_par0 ; sleep 3s; cat /lib/firmware/sysmobts-v?.out > /dev/dspdl_dm644x_0; sleep 1s' +Restart=always +RestartSec=2 +RestartPreventExitStatus=1 + +# The msg queues must be read fast enough +CPUSchedulingPolicy=rr +CPUSchedulingPriority=1 + +[Install] +WantedBy=multi-user.target +Alias=sysmobts.service diff --git a/contrib/sysmobts.service b/contrib/sysmobts.service index e07a3db8..64e01271 100644 --- a/contrib/sysmobts.service +++ b/contrib/sysmobts.service @@ -17,3 +17,4 @@ CPUSchedulingPriority=1 [Install] WantedBy=multi-user.target +Alias=osmo-bts-sysmo.service diff --git a/src/osmo-bts-sysmo/misc/sysmobts_mgr_temp.c b/src/osmo-bts-sysmo/misc/sysmobts_mgr_temp.c index f01fd14d..1be56ac2 100644 --- a/src/osmo-bts-sysmo/misc/sysmobts_mgr_temp.c +++ b/src/osmo-bts-sysmo/misc/sysmobts_mgr_temp.c @@ -116,7 +116,7 @@ static void handle_normal_actions(int actions) * and used SIGCHLD/waitpid to pick up the dead processes * without invoking shell. */ - system("/bin/systemctl start sysmobts.service"); + system("/bin/systemctl start osmo-bts-sysmo"); } } @@ -157,7 +157,7 @@ static void handle_actions(int actions) * and used SIGCHLD/waitpid to pick up the dead processes * without invoking shell. */ - system("/bin/systemctl stop sysmobts.service"); + system("/bin/systemctl stop osmo-bts-sysmo"); } } diff --git a/src/osmo-bts-sysmo/misc/sysmobts_mgr_vty.c b/src/osmo-bts-sysmo/misc/sysmobts_mgr_vty.c index 3020d904..b49f282a 100644 --- a/src/osmo-bts-sysmo/misc/sysmobts_mgr_vty.c +++ b/src/osmo-bts-sysmo/misc/sysmobts_mgr_vty.c @@ -284,7 +284,7 @@ DEFUN(cfg_no_action_pa_on, cfg_no_action_pa_on_cmd, DEFUN(cfg_action_bts_srv_on, cfg_action_bts_srv_on_cmd, "bts-service-on", - "Start the systemd sysmobts.service\n") + "Start the systemd osmo-bts-sysmo.service\n") { int *action = vty->index; *action |= TEMP_ACT_NORM_BTS_SRV_ON; @@ -293,7 +293,7 @@ DEFUN(cfg_action_bts_srv_on, cfg_action_bts_srv_on_cmd, DEFUN(cfg_no_action_bts_srv_on, cfg_no_action_bts_srv_on_cmd, "no bts-service-on", - NO_STR "Start the systemd sysmobts.service\n") + NO_STR "Start the systemd osmo-bts-sysmo.service\n") { int *action = vty->index; *action &= ~TEMP_ACT_NORM_BTS_SRV_ON; @@ -338,7 +338,7 @@ DEFUN(cfg_no_action_pa_off, cfg_no_action_pa_off_cmd, DEFUN(cfg_action_bts_srv_off, cfg_action_bts_srv_off_cmd, "bts-service-off", - "Stop the systemd sysmobts.service\n") + "Stop the systemd osmo-bts-sysmo.service\n") { int *action = vty->index; *action |= TEMP_ACT_BTS_SRV_OFF; @@ -347,7 +347,7 @@ DEFUN(cfg_action_bts_srv_off, cfg_action_bts_srv_off_cmd, 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") + NO_STR "Stop the systemd osmo-bts-sysmo.service\n") { int *action = vty->index; *action &= ~TEMP_ACT_BTS_SRV_OFF; -- cgit v1.2.3