Restore the branch

This commit is contained in:
Jonathan Naylor
2020-12-15 16:21:07 +00:00
parent 135fd04e0d
commit d77e2a00ce
126 changed files with 12881 additions and 8106 deletions

View File

@@ -0,0 +1,24 @@
MMDVMHost Init setup
=======================
Preface
-------
Init script setup for Linux systems using the older Init setup (not Systemd)
I hope this helps you get going quickly.
Written on / tested on / confirmed working on Raspbian Wheezy but should work just fine on any
system using init scripts.
Enjoy, 73 de MW0MWZ
Install Instructions
--------------------
1. Copy mmdvmhost to /etc/init.d
2. Change the permisions of /etc/init.d/mmdvmhost to 550 (root executable)
3. Change the variables in /etc/init.d/mmdvmhost to match your setup
(MMDVMHost.ini location, log location, user and daemon location)
4. Enable the service "update-rc.d mmdvmhost defaults" on Rasbian Wheezy

View File

@@ -0,0 +1,98 @@
#!/bin/sh
### BEGIN INIT INFO
# Provides: mmdvmhost
# Required-Start: $local_fs $remote_fs $network $syslog
# Required-Stop: $local_fs $remote_fs $network $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: starts the mmdvmhost server
# Description: starts mmdvmhost using start-stop-daemon
### END INIT INFO
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
DAEMON=/usr/local/bin/MMDVMHost
CONFIG=/etc/mmdvmhost
NAME=mmdvmhost
DESC=MMDVMHost
USER=mmdvm
GROUP=mmdvm
LOGDIR=/var/log/mmdvmhost
ipVar=`hostname -I | cut -d' ' -f1`
test -x $DAEMON || exit 0
test -r $CONFIG || exit 0
# Verify the logging directory exists, if not create it and setup the ownership / permissions
if [ ! -d $LOGDIR ]; then
mkdir -p $LOGDIR
chown root:$GROUP $LOGDIR
chmod 775 $LOGDIR
fi
set -e
. /lib/lsb/init-functions
case "$1" in
start)
# Wait for an IP address
until [ "$ipVar" != " " ]; do
sleep 10
ipVar=`hostname -I`
done
if ! pgrep "MMDVMHost" > /dev/null 2>&1; then
log_daemon_msg "Starting Repeater services" "$NAME" || true
if start-stop-daemon --start --quiet --background --oknodo --pidfile /var/run/$NAME.pid \
--exec $DAEMON $CONFIG -- $DAEMON_OPTS; then
log_end_msg 0 || true
else
log_end_msg 1 || true
fi
if pgrep "MMDVMHost" > /dev/null 2>&1; then
pgrep "MMDVMHost" > /var/run/$NAME.pid
fi
fi
;;
stop)
log_daemon_msg "Stopping Repeater services" "$NAME" || true
if start-stop-daemon --stop --quiet --oknodo --pidfile /var/run/$NAME.pid \
--exec $DAEMON $CONFIG; then
log_end_msg 0 || true
else
log_end_msg 1 || true
fi
;;
restart|force-reload|reload)
log_daemon_msg "Restarting Repeater services" "$NAME" || true
start-stop-daemon --stop --quiet --oknodo --pidfile \
/var/run/$NAME.pid --exec $DAEMON $CONFIG
sleep 1
if start-stop-daemon --start --quiet --background --oknodo --pidfile \
/var/run/$NAME.pid --exec $DAEMON $CONFIG -- $DAEMON_OPTS; then
log_end_msg 0 || true
else
log_end_msg 1 || true
fi
if pgrep "MMDVMHost" > /dev/null 2>&1; then
pgrep "MMDVMHost" > /var/run/$NAME.pid
fi
;;
status)
status_of_proc -p /var/run/$NAME.pid "$DAEMON" "$NAME" && exit 0 || exit $?
;;
*)
echo "Usage: $NAME {start|stop|restart|reload|force-reload|status}" >&2
exit 1
;;
esac
exit 0

View File

@@ -0,0 +1,31 @@
MMDVMHost Systemd setup
=======================
Preface
-------
Since moving to Systemd many admins are struggling with the differences, in an effort to take the work
out of installing MMDVMHost on your linux host, I have written a service handler and the related systemd
unit files.
I hope these help you get going quickly.
Written on / tested on / confirmed working on Raspbian Jessie-lite but should work just fine on any
system using systemd.
Enjoy, 73 de MW0MWZ
Install Instructions
--------------------
1. Copy mmdvmhost_service to /usr/local/sbin
2. Change the permisions of /usr/local/sbin/mmdvmhost_service to 500 (root executable)
3. Change the variables in /usr/local/sbin/mmdvmhost_service to match your setup
(MMDVMHost.ini location, log location, user and daemon location)
4. Copy mmdvmhost.service to /lib/systemd/system
5. Copy mmdvmhost.timer to /lib/systemd/system
6. Edit the timeout in mmdvmhost.timer to suit - 45 secs is a reasonable starting point.
7. Reload systemctl with: "systemctl daemon-reload"
8. Add the timer serice to the boot with: "systemctl enable mmdvmhost.timer"
**NOTE - There is no need / desire to enable mmdvmhost.service!

View File

@@ -0,0 +1,12 @@
[Unit]
Description=MMDVMHost Radio Servce
After=syslog.target network.target
[Service]
Type=forking
ExecStart=/usr/local/sbin/mmdvmhost_service start
ExecStop=/usr/local/sbin/mmdvmhost_service stop
ExecReload=/usr/local/sbin/mmdvmhost_service restart
[Install]
WantedBy=multi-user.target

View File

@@ -0,0 +1,5 @@
[Timer]
OnStartupSec=45
[Install]
WantedBy=multi-user.target

View File

@@ -0,0 +1,85 @@
#!/bin/bash
#########################################################
# #
# MMDVMHost Service Handler #
# #
# Written for Pi-Star (http://www.mw0mwz.co.uk/pi-star) #
# By Andy Taylor (MW0MWZ) #
# #
# Version 1.1 #
# #
#########################################################
# Service Config
DAEMON=MMDVMHost
DAEMON_PATH=/usr/local/bin/
CONFIG=/etc/mmdvmhost
DAEMON_OPTS=$CONFIG
PGREP=/usr/bin/pgrep
KILL=/bin/kill
SLEEP=/bin/sleep
USER=mmdvm
GROUP=mmdvm
LOGDIR=/var/log/pi-star
# Pre-flight checks...
test -x ${DAEMON_PATH}${DAEMON} || exit 1
test -r $CONFIG || exit 1
# Verify the logging directory exists, if not create it and setup the ownership / permissions
if [ ! -d $LOGDIR ]; then
mkdir -p $LOGDIR
chown root:$GROUP $LOGDIR
chmod 775 $LOGDIR
fi
case "$1" in
start)
if [ `${PGREP} ${DAEMON}` ]; then
echo -e "$DAEMON is already running as PID "`$PGREP $DAEMON`
exit 1;
else
runuser -l $USER -c "${DAEMON_PATH}${DAEMON} ${DAEMON_OPTS}"
echo -e "$DAEMON started as PID "`$PGREP $DAEMON`
exit 0;
fi
;;
stop)
if [ `${PGREP} ${DAEMON}` ]; then
echo -e "Killing $DAEMON PID "`$PGREP $DAEMON`
$KILL `${PGREP} ${DAEMON}`
exit 0;
else
echo -e "$DAEMON is not running"
exit 1;
fi
;;
restart)
if [ `$PGREP $DAEMON` ]; then
echo -e "Killing $DAEMON PID "`$PGREP $DAEMON`
$KILL `${PGREP} ${DAEMON}`
$SLEEP 3
runuser -l $USER -c "${DAEMON_PATH}${DAEMON} ${DAEMON_OPTS}"
echo -e "$DAEMON re-started as PID "`${PGREP} ${DAEMON}`
exit 0;
else
echo -e "$DAEMON is not running"
${DAEMON_PATH}${DAEMON} ${DAEMON_OPTS}
echo -e "$DAEMON started as PID "`${PGREP} ${DAEMON}`
exit 0;
fi
;;
status)
if [ `${PGREP} ${DAEMON}` ]; then
echo -e "$DAEMON is running as PID "`${PGREP} ${DAEMON}`
else
echo -e "$DAEMON is not running"
fi
;;
*)
echo $"Usage: $0 {start|stop|restart|status}"
exit 1
esac