mirror of
https://github.com/g4klx/MMDVMHost
synced 2025-12-22 08:05:49 +08:00
Restore the branch
This commit is contained in:
@@ -1,31 +0,0 @@
|
||||
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!
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
[Unit]
|
||||
Description=MMDVMHost Radio Servce
|
||||
Description=MMDVMHost Radio Service
|
||||
After=syslog.target network.target
|
||||
|
||||
[Service]
|
||||
User=mmdvm
|
||||
Type=forking
|
||||
ExecStart=/usr/local/sbin/mmdvmhost_service start
|
||||
ExecStop=/usr/local/sbin/mmdvmhost_service stop
|
||||
ExecReload=/usr/local/sbin/mmdvmhost_service restart
|
||||
ExecStart=/usr/local/bin/MMDVMHost
|
||||
Restart=on-abnormal
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
|
||||
@@ -1,5 +0,0 @@
|
||||
[Timer]
|
||||
OnStartupSec=45
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
@@ -1,85 +0,0 @@
|
||||
#!/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
|
||||
Reference in New Issue
Block a user