From 126b162376d0c00ad0058bc23f79e17deb3394a7 Mon Sep 17 00:00:00 2001 From: Malik Saad <35887695+maliksaad84@users.noreply.github.com> Date: Tue, 10 Mar 2020 23:11:51 -0700 Subject: [PATCH] Add files via upload --- openbts_systemd_scripts-master/README.md | 12 +++++ openbts_systemd_scripts-master/openbts-cli.sh | 3 ++ .../openbts-start.sh | 38 ++++++++++++++++ .../openbts-stop.sh | 10 +++++ .../systemd/asterisk.service | 13 ++++++ .../systemd/openbts.service | 10 +++++ .../systemd/sipauthserve.service | 9 ++++ .../systemd/smqueue.service | 9 ++++ .../upstart/asterisk.conf | 44 +++++++++++++++++++ .../upstart/openbts.conf | 43 ++++++++++++++++++ .../upstart/sipauthserve.conf | 10 +++++ .../upstart/smqueue.conf | 10 +++++ 12 files changed, 211 insertions(+) create mode 100644 openbts_systemd_scripts-master/README.md create mode 100644 openbts_systemd_scripts-master/openbts-cli.sh create mode 100644 openbts_systemd_scripts-master/openbts-start.sh create mode 100644 openbts_systemd_scripts-master/openbts-stop.sh create mode 100644 openbts_systemd_scripts-master/systemd/asterisk.service create mode 100644 openbts_systemd_scripts-master/systemd/openbts.service create mode 100644 openbts_systemd_scripts-master/systemd/sipauthserve.service create mode 100644 openbts_systemd_scripts-master/systemd/smqueue.service create mode 100644 openbts_systemd_scripts-master/upstart/asterisk.conf create mode 100644 openbts_systemd_scripts-master/upstart/openbts.conf create mode 100644 openbts_systemd_scripts-master/upstart/sipauthserve.conf create mode 100644 openbts_systemd_scripts-master/upstart/smqueue.conf diff --git a/openbts_systemd_scripts-master/README.md b/openbts_systemd_scripts-master/README.md new file mode 100644 index 0000000..b12b8d3 --- /dev/null +++ b/openbts_systemd_scripts-master/README.md @@ -0,0 +1,12 @@ +# OpenBTS scripts for systemd +In this repository You will find OpenBTS related scripts. + +The scripts is created to run OpenBTS services on Ubuntu 16.04 with ```systemd``` init system. + +To run OpenBTS, Asterisk, SipAuthServe and Smqueue services on Ubuntu 16.04: +1. Copy all files from folder systemd to ```/etc/systemd/system/``` folder on your computer. +2. Execute ```systemctl reload``` and all services will be availible from ```systemctl``` utility. + +To run/stop service with ```systemctl``` execute ```systemctl start service_name``` or ```systemctl stop service_name``` + +To start/stop all services, use ```openbts-start.sh``` and ```openbts-stop.sh```. diff --git a/openbts_systemd_scripts-master/openbts-cli.sh b/openbts_systemd_scripts-master/openbts-cli.sh new file mode 100644 index 0000000..ec8a814 --- /dev/null +++ b/openbts_systemd_scripts-master/openbts-cli.sh @@ -0,0 +1,3 @@ +#!/bin/bash +sudo /OpenBTS/OpenBTSCLI + diff --git a/openbts_systemd_scripts-master/openbts-start.sh b/openbts_systemd_scripts-master/openbts-start.sh new file mode 100644 index 0000000..12cab0a --- /dev/null +++ b/openbts_systemd_scripts-master/openbts-start.sh @@ -0,0 +1,38 @@ +#!/bin/sh + +# Since Ubuntu clears /var/run on reboot, create this before we try to start +if [ ! -e /var/run/OpenBTS ]; then + mkdir /var/run/OpenBTS +fi + +if [ ! -e /var/run/rrlp ]; then + mkdir /var/run/rrlp + chmod 777 /var/run/rrlp +fi + +# place for CRD data +if [ ! -e /var/lib/OpenBTS ]; then + mkdir /var/lib/OpenBTS +fi + +if [ ! -d /var/run/asterisk ]; then + mkdir -p asterisk /var/run/asterisk + chown asterisk: /var/run/asterisk +fi + +# Make sure permissions are set up correctly +if [ -d /var/lib/asterisk/sqlite3dir ]; then + chown -R asterisk:www-data /var/lib/asterisk/sqlite3dir + chmod 775 /var/lib/asterisk/sqlite3dir + chmod 664 /var/lib/asterisk/sqlite3dir/sqlite3* +fi + +systemctl start asterisk +systemctl start sipauthserve +systemctl start smqueue +systemctl start openbts + +echo -n "Asterisk PID: " ; echo `ps -ef | grep "asterisk" | grep -wv 'grep\|vi\|vim'` | awk '{print $2}' +echo -n "Sipauthserve PID: " ; echo `ps -ef | grep "sipauthserve" | grep -wv 'grep\|vi\|vim'` | awk '{print $2}' +echo -n "Smqueue PID: " ; echo `ps -ef | grep "smqueue" | grep -wv 'grep\|vi\|vim'` | awk '{print $2}' +echo -n "OpenBTS PID: " ; echo `ps -ef | grep "OpenBTS" | grep -wv 'grep\|vi\|vim'` | awk '{print $2}' diff --git a/openbts_systemd_scripts-master/openbts-stop.sh b/openbts_systemd_scripts-master/openbts-stop.sh new file mode 100644 index 0000000..1956b26 --- /dev/null +++ b/openbts_systemd_scripts-master/openbts-stop.sh @@ -0,0 +1,10 @@ +#!/bin/sh + +# Might as well clean up after ourselves, too. +rm -rf /var/run/asterisk +if pgrep transceiver; then killall transceiver; fi + +systemctl stop asterisk +systemctl stop sipauthserve +systemctl stop smqueue +systemctl stop openbts diff --git a/openbts_systemd_scripts-master/systemd/asterisk.service b/openbts_systemd_scripts-master/systemd/asterisk.service new file mode 100644 index 0000000..2caeea4 --- /dev/null +++ b/openbts_systemd_scripts-master/systemd/asterisk.service @@ -0,0 +1,13 @@ +[Unit] +Description=Asterisk PBX And Telephony Daemon +After=network.target +Documentation=man:asterisk(8) + +[Service] +Type=simple +ExecStart=/usr/sbin/asterisk -f -g +ExecStop=/usr/bin/asterisk -rx 'core stop now' +ExecReload=/usr/bin/asterisk -rx 'core reload' + +[Install] +WantedBy=multi-user.target diff --git a/openbts_systemd_scripts-master/systemd/openbts.service b/openbts_systemd_scripts-master/systemd/openbts.service new file mode 100644 index 0000000..719f2e1 --- /dev/null +++ b/openbts_systemd_scripts-master/systemd/openbts.service @@ -0,0 +1,10 @@ +[Unit] +Description=OpenBTS + +[Service] +Type=simple +ExecStart=/OpenBTS/OpenBTS +WorkingDirectory=/OpenBTS + +[Install] +WantedBy=multi-user.target diff --git a/openbts_systemd_scripts-master/systemd/sipauthserve.service b/openbts_systemd_scripts-master/systemd/sipauthserve.service new file mode 100644 index 0000000..c9e3b0d --- /dev/null +++ b/openbts_systemd_scripts-master/systemd/sipauthserve.service @@ -0,0 +1,9 @@ +[Unit] +Description=sipauthserve + +[Service] +Type=simple +ExecStart=/OpenBTS/sipauthserve + +[Install] +WantedBy=multi-user.target diff --git a/openbts_systemd_scripts-master/systemd/smqueue.service b/openbts_systemd_scripts-master/systemd/smqueue.service new file mode 100644 index 0000000..f2c5a03 --- /dev/null +++ b/openbts_systemd_scripts-master/systemd/smqueue.service @@ -0,0 +1,9 @@ +[Unit] +Description=smqueue + +[Service] +Type=simple +ExecStart=/OpenBTS/smqueue + +[Install] +WantedBy=multi-user.target diff --git a/openbts_systemd_scripts-master/upstart/asterisk.conf b/openbts_systemd_scripts-master/upstart/asterisk.conf new file mode 100644 index 0000000..00fecd8 --- /dev/null +++ b/openbts_systemd_scripts-master/upstart/asterisk.conf @@ -0,0 +1,44 @@ +# asterisk +# +# Upstart control file for the Asterisk PBX +# +# To install, rename this file to 'asterisk' and copy it to /etc/event.d/ +# On Debian: copy to /etc/init/ +# +# To start asterisk manually: +# sudo start asterisk +# +# To stop asterisk manually: +# sudo stop asterisk +# +# Asterisk is started with an "interactive console", though redirected +# to/from /dev/null . The concept of a main console is bad. OTOH, the main +# process should not detach from the console if we work with upstart and +# alike. +# +# The username 'asterisk' is currently hardwired here, and likewise the +# varrundir. +# + +description "Asterisk PBX" +#version "1.6.3" + +start on runlevel [2345] +stop on runlevel [!2345] + +pre-start script + # Since Ubuntu clears /var/run on reboot, create this before we try to start + if [ ! -d /var/run/asterisk ]; then + mkdir -p asterisk /var/run/asterisk + chown asterisk: /var/run/asterisk + fi +end script + +#console output +respawn +exec /usr/sbin/asterisk -U asterisk -g -f + +post-stop script + # Might as well clean up after ourselves, too. + rm -rf /var/run/asterisk +end script diff --git a/openbts_systemd_scripts-master/upstart/openbts.conf b/openbts_systemd_scripts-master/upstart/openbts.conf new file mode 100644 index 0000000..c37544d --- /dev/null +++ b/openbts_systemd_scripts-master/upstart/openbts.conf @@ -0,0 +1,43 @@ +# openbts - Range Networks RAN for GSM and GPRS +# +# This service runs openbts from the point the system is +# started until it is shut down again. + +start on stopped rc RUNLEVEL=[2345] +stop on runlevel [!2345] + +respawn +script + cd /OpenBTS +# Uncomment this line and comment out the default ./OpenBTS line to enable automatic gdb backtraces to /OpenBTS/gdb.txt (via .gdbinit) +# exec gdb + exec ./OpenBTS +end script + +pre-start script + # Since Ubuntu clears /var/run on reboot, create this before we try to start + if [ ! -e /var/run/OpenBTS ]; then + mkdir /var/run/OpenBTS + fi + + if [ ! -e /var/run/rrlp ]; then + mkdir /var/run/rrlp + chmod 777 /var/run/rrlp + fi + + # place for CRD data + if [ ! -e /var/lib/OpenBTS ]; then + mkdir /var/lib/OpenBTS + fi + +# make sure permissions are set up correctly +if [ -d /var/lib/asterisk/sqlite3dir ]; then + chown -R asterisk:www-data /var/lib/asterisk/sqlite3dir + chmod 775 /var/lib/asterisk/sqlite3dir + chmod 664 /var/lib/asterisk/sqlite3dir/sqlite3* +fi +end script + +post-stop script + if pgrep transceiver; then killall transceiver; fi +end script diff --git a/openbts_systemd_scripts-master/upstart/sipauthserve.conf b/openbts_systemd_scripts-master/upstart/sipauthserve.conf new file mode 100644 index 0000000..66684c7 --- /dev/null +++ b/openbts_systemd_scripts-master/upstart/sipauthserve.conf @@ -0,0 +1,10 @@ +# sipauthserve - Range Networks SIP Authorization Server +# +# This service runs sipauthserve from the point the system is +# started until it is shut down again. + +start on stopped rc RUNLEVEL=[2345] +stop on runlevel [!2345] + +respawn +exec /OpenBTS/sipauthserve diff --git a/openbts_systemd_scripts-master/upstart/smqueue.conf b/openbts_systemd_scripts-master/upstart/smqueue.conf new file mode 100644 index 0000000..2a5bb36 --- /dev/null +++ b/openbts_systemd_scripts-master/upstart/smqueue.conf @@ -0,0 +1,10 @@ +# smqueue - Range Networks basic SMSC +# +# This service runs smqueue from the point the system is +# started until it is shut down again. + +start on stopped rc RUNLEVEL=[2345] +stop on runlevel [!2345] + +respawn +exec /OpenBTS/smqueue