Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions openbts_systemd_scripts-master/README.md
Original file line number Diff line number Diff line change
@@ -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```.
3 changes: 3 additions & 0 deletions openbts_systemd_scripts-master/openbts-cli.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/bash
sudo /OpenBTS/OpenBTSCLI

38 changes: 38 additions & 0 deletions openbts_systemd_scripts-master/openbts-start.sh
Original file line number Diff line number Diff line change
@@ -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}'
10 changes: 10 additions & 0 deletions openbts_systemd_scripts-master/openbts-stop.sh
Original file line number Diff line number Diff line change
@@ -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
13 changes: 13 additions & 0 deletions openbts_systemd_scripts-master/systemd/asterisk.service
Original file line number Diff line number Diff line change
@@ -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
10 changes: 10 additions & 0 deletions openbts_systemd_scripts-master/systemd/openbts.service
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
[Unit]
Description=OpenBTS

[Service]
Type=simple
ExecStart=/OpenBTS/OpenBTS
WorkingDirectory=/OpenBTS

[Install]
WantedBy=multi-user.target
9 changes: 9 additions & 0 deletions openbts_systemd_scripts-master/systemd/sipauthserve.service
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[Unit]
Description=sipauthserve

[Service]
Type=simple
ExecStart=/OpenBTS/sipauthserve

[Install]
WantedBy=multi-user.target
9 changes: 9 additions & 0 deletions openbts_systemd_scripts-master/systemd/smqueue.service
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[Unit]
Description=smqueue

[Service]
Type=simple
ExecStart=/OpenBTS/smqueue

[Install]
WantedBy=multi-user.target
44 changes: 44 additions & 0 deletions openbts_systemd_scripts-master/upstart/asterisk.conf
Original file line number Diff line number Diff line change
@@ -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
43 changes: 43 additions & 0 deletions openbts_systemd_scripts-master/upstart/openbts.conf
Original file line number Diff line number Diff line change
@@ -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
10 changes: 10 additions & 0 deletions openbts_systemd_scripts-master/upstart/sipauthserve.conf
Original file line number Diff line number Diff line change
@@ -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
10 changes: 10 additions & 0 deletions openbts_systemd_scripts-master/upstart/smqueue.conf
Original file line number Diff line number Diff line change
@@ -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