diff options
author | Pau Espin Pedrol <pespin@sysmocom.de> | 2018-09-10 13:18:13 +0200 |
---|---|---|
committer | Pau Espin Pedrol <pespin@sysmocom.de> | 2018-09-12 14:16:49 +0200 |
commit | 65d3cc77539c565215e067ff5447f6d1cbab21e4 (patch) | |
tree | e55b6c5a99a25c5f0981fdb8c24fc072da4bf04e /contrib/systemd | |
parent | 17577b7c00d4748d318034ca2babe54b8b8f769d (diff) |
Install systemd services with autotools
Change-Id: I87299134696bbfc6721b1226d4de6c73854aa846
Diffstat (limited to 'contrib/systemd')
-rw-r--r-- | contrib/systemd/Makefile.am | 18 | ||||
-rw-r--r-- | contrib/systemd/lc15bts-mgr.service | 29 | ||||
-rw-r--r-- | contrib/systemd/osmo-bts-lc15.service | 21 | ||||
-rw-r--r-- | contrib/systemd/osmo-bts-sysmo.service | 21 | ||||
-rw-r--r-- | contrib/systemd/sysmobts-mgr.service | 12 |
5 files changed, 101 insertions, 0 deletions
diff --git a/contrib/systemd/Makefile.am b/contrib/systemd/Makefile.am new file mode 100644 index 00000000..16463087 --- /dev/null +++ b/contrib/systemd/Makefile.am @@ -0,0 +1,18 @@ +if HAVE_SYSTEMD +SYSTEMD_SERVICES = osmo-bts-virtual.service + +if ENABLE_SYSMOBTS +SYSTEMD_SERVICES += osmo-bts-sysmo.service sysmobts-mgr.service +endif + +if ENABLE_TRX +SYSTEMD_SERVICES += osmo-bts-trx.service +endif + +if ENABLE_LC15BTS +SYSTEMD_SERVICES += osmo-bts-lc15.service lc15bts-mgr.service +endif + +EXTRA_DIST = $(SYSTEMD_SERVICES) +systemdsystemunit_DATA = $(SYSTEMD_SERVICES) +endif # HAVE_SYSTEMD diff --git a/contrib/systemd/lc15bts-mgr.service b/contrib/systemd/lc15bts-mgr.service new file mode 100644 index 00000000..bf788e61 --- /dev/null +++ b/contrib/systemd/lc15bts-mgr.service @@ -0,0 +1,29 @@ +[Unit] +Description=osmo-bts manager for LC15 / sysmoBTS 2100 +After=lc15-sysdev-remap.service +Wants=lc15-sysdev-remap.service + +[Service] +Type=simple +NotifyAccess=all +WatchdogSec=21780s +Restart=always +RestartSec=2 + +# Make sure directories and symbolic link exist +ExecStartPre=/bin/sh -c 'test -d /mnt/storage/var/run/lc15bts-mgr || mkdir -p /mnt/storage/var/run/lc15bts-mgr ; test -d /var/run/lc15bts-mgr || ln -sf /mnt/storage/var/run/lc15bts-mgr/ /var/run' +# Make sure BTS operation hour exist +ExecStartPre=/bin/sh -c 'test -f /mnt/storage/var/run/lc15bts-mgr/hours-running || echo 0 > /mnt/storage/var/run/lc15bts-mgr/hours-running' +# Shutdown all PA correctly +ExecStartPre=/bin/sh -c 'echo disabled > /var/lc15/pa-state/pa0/state; echo disabled > /var/lc15/pa-state/pa1/state' +ExecStartPre=/bin/sh -c 'echo 0 > /var/lc15/pa-supply/max_microvolts; echo 0 > /var/lc15/pa-supply/min_microvolts' + +ExecStart=/usr/bin/lc15bts-mgr -s -c /etc/osmocom/lc15bts-mgr.cfg + +# Shutdown all PA correctly +ExecStopPost=/bin/sh -c 'echo disabled > /var/lc15/pa-state/pa0/state; echo disabled > /var/lc15/pa-state/pa1/state' +ExecStopPost=/bin/sh -c 'echo 0 > /var/lc15/pa-supply/max_microvolts; echo 0 > /var/lc15/pa-supply/min_microvolts' + +[Install] +WantedBy=multi-user.target +Alias=osmo-bts-mgr.service diff --git a/contrib/systemd/osmo-bts-lc15.service b/contrib/systemd/osmo-bts-lc15.service new file mode 100644 index 00000000..6aa9751f --- /dev/null +++ b/contrib/systemd/osmo-bts-lc15.service @@ -0,0 +1,21 @@ +[Unit] +Description=osmo-bts for LC15 / sysmoBTS 2100 + +[Service] +Type=simple +ExecStartPre=/bin/sh -c 'echo 1 > /sys/class/leds/usr0/brightness' +ExecStartPre=/bin/sh -c 'echo 1 > /sys/class/leds/usr1/brightness' +ExecStart=/usr/bin/osmo-bts-lc15 -t 2 -s -c /etc/osmocom/osmo-bts.cfg -M +ExecStopPost=/bin/sh -c 'echo 1 > /sys/class/leds/usr0/brightness' +ExecStopPost=/bin/sh -c 'echo 0 > /sys/class/leds/usr1/brightness' +Restart=always +RestartSec=2 +RestartPreventExitStatus=1 + +# The msg queues must be read fast enough +CPUSchedulingPolicy=rr +CPUSchedulingPriority=1 + +[Install] +WantedBy=multi-user.target +Alias=osmo-bts.service diff --git a/contrib/systemd/osmo-bts-sysmo.service b/contrib/systemd/osmo-bts-sysmo.service new file mode 100644 index 00000000..65b1f00b --- /dev/null +++ b/contrib/systemd/osmo-bts-sysmo.service @@ -0,0 +1,21 @@ +[Unit] +Description=osmo-bts for 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 +Alias=osmo-bts.service diff --git a/contrib/systemd/sysmobts-mgr.service b/contrib/systemd/sysmobts-mgr.service new file mode 100644 index 00000000..4346991d --- /dev/null +++ b/contrib/systemd/sysmobts-mgr.service @@ -0,0 +1,12 @@ +[Unit] +Description=osmo-bts manager for sysmoBTS + +[Service] +Type=simple +ExecStart=/usr/bin/sysmobts-mgr -ns -c /etc/osmocom/sysmobts-mgr.cfg +Restart=always +RestartSec=2 + +[Install] +WantedBy=multi-user.target +Alias=osmo-bts-mgr.service |