- system page to new button names "HOTSPOT ON/OFF" - added some linux files to make use of them as example files in "/usr/local/sbin/"master v2.2
parent
cf96c99103
commit
946ae33596
Binary file not shown.
Binary file not shown.
@ -0,0 +1,72 @@
|
|||||||
|
# Useful files to keep on your Raspberry Pi
|
||||||
|
|
||||||
|
Use these files as examples and modify them to fit your needs.
|
||||||
|
|
||||||
|
Place the executable files in `/usr/local/sbin` and save `index.txt` as
|
||||||
|
`/root/index.html`.
|
||||||
|
|
||||||
|
## index.txt
|
||||||
|
|
||||||
|
This file contains the website that is shown when you stop the dashboard. It gets
|
||||||
|
copied into the webroot of your webserver -- make sure your webserver reads
|
||||||
|
`index.html` files **before** `index.php` files.
|
||||||
|
|
||||||
|
## dashboard
|
||||||
|
|
||||||
|
Executable file. Make sure to `chmod +x` this file.
|
||||||
|
|
||||||
|
Start or stop the dashboard with this command. This toggles the systemd service
|
||||||
|
|
||||||
|
- php7.3-fpm.service
|
||||||
|
|
||||||
|
Usage:
|
||||||
|
|
||||||
|
```
|
||||||
|
/usr/local/sbin/dashboard {on|off}
|
||||||
|
```
|
||||||
|
|
||||||
|
## hotspot
|
||||||
|
|
||||||
|
Executable file. Make sure to `chmod +x` this file.
|
||||||
|
|
||||||
|
Start or stop your hotspot. This toggles the systemd services
|
||||||
|
|
||||||
|
- mmdvmhost.timer
|
||||||
|
- mmdvmhost.service
|
||||||
|
|
||||||
|
Additionally it starts or stops the dashboard command mentioned above.
|
||||||
|
|
||||||
|
Usage:
|
||||||
|
|
||||||
|
```
|
||||||
|
/usr/local/sbin/hotspot {on|off}
|
||||||
|
```
|
||||||
|
|
||||||
|
### Start and stop the hotspot via Cron
|
||||||
|
|
||||||
|
Place these lines in your `/etc/crontab` to automatically start and/or stop
|
||||||
|
your hotspot.
|
||||||
|
|
||||||
|
```
|
||||||
|
30 6 * * 1-5 root /usr/local/sbin/hotspot off
|
||||||
|
0 18 * * 1-5 root /usr/local/sbin/hotspot on
|
||||||
|
```
|
||||||
|
|
||||||
|
That might stop the hotspot at 6:30 and start it again at 18:00, Monday to Friday.
|
||||||
|
|
||||||
|
## shrinklog
|
||||||
|
|
||||||
|
Executable file. Make sure to `chmod +x` this file.
|
||||||
|
|
||||||
|
This command shrinks the MMDVMHost log file to a limited number of important
|
||||||
|
lines.
|
||||||
|
|
||||||
|
The code of this was primarily taken from [Pi-Star][shrinklog] and modified.
|
||||||
|
|
||||||
|
[shrinklog]: https://github.com/AndyTaylorTweet/Pi-Star_Binaries_sbin/blob/master/pistar-hourly.cron
|
||||||
|
|
||||||
|
Usage:
|
||||||
|
|
||||||
|
```
|
||||||
|
/usr/local/sbin/shrinklog
|
||||||
|
```
|
@ -0,0 +1,26 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
if [ "$EUID" -ne 0 ]
|
||||||
|
then echo "root privileges needed. Aborting."
|
||||||
|
exit
|
||||||
|
fi
|
||||||
|
|
||||||
|
case "$1" in
|
||||||
|
start|on)
|
||||||
|
echo -n "Starting the web dashboard..."
|
||||||
|
systemctl start php7.3-fpm.service
|
||||||
|
rm -f /var/www/html/index.html
|
||||||
|
echo " OK"
|
||||||
|
;;
|
||||||
|
|
||||||
|
stop|off)
|
||||||
|
echo -n "Stopping the web dashboard..."
|
||||||
|
cp -a /root/index.html /var/www/html/index.html
|
||||||
|
systemctl stop php7.3-fpm.service
|
||||||
|
echo " OK"
|
||||||
|
;;
|
||||||
|
|
||||||
|
*)
|
||||||
|
echo $"Usage: $0 {start|stop}"
|
||||||
|
exit 1
|
||||||
|
esac
|
@ -0,0 +1,27 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
if [ "$EUID" -ne 0 ]
|
||||||
|
then echo "root privileges needed. Aborting."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
case "$1" in
|
||||||
|
on)
|
||||||
|
systemctl start mmdvmhost.timer
|
||||||
|
systemctl start mmdvmhost.service
|
||||||
|
/usr/local/sbin/dashboard on
|
||||||
|
;;
|
||||||
|
|
||||||
|
off)
|
||||||
|
systemctl stop mmdvmhost.timer
|
||||||
|
systemctl stop mmdvmhost.service
|
||||||
|
/usr/local/sbin/dashboard off
|
||||||
|
;;
|
||||||
|
help)
|
||||||
|
echo "$(basename $0)"
|
||||||
|
echo " Enable or disable systemd services for MMDVMHost"
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
echo "usage: $(basename $0) [ on | off ]"
|
||||||
|
exit 1
|
||||||
|
esac
|
@ -0,0 +1,35 @@
|
|||||||
|
<!DOCTYPE html><html lang="de_AT">
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<meta name='HandheldFriendly' content='True'>
|
||||||
|
<meta name='MobileOptimized' content='320'>
|
||||||
|
<meta name='viewport' content='width=device-width, initial-scale=1, maximum-scale=1'>
|
||||||
|
|
||||||
|
<title>OE7DRT - MMDVM-Dashboard by DG9VH</title>
|
||||||
|
<style>
|
||||||
|
.center {
|
||||||
|
font-family: Input, Monospace, fixed;
|
||||||
|
font-size: 110%;
|
||||||
|
height: 100vh;
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
@media only screen
|
||||||
|
and (max-width : 500px) {
|
||||||
|
.center {
|
||||||
|
font-size: 80%;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div class="center">
|
||||||
|
<p>The dashboard is not available right now, please try
|
||||||
|
again later!<br><br>
|
||||||
|
<a href="#" onclick="location.reload(true);
|
||||||
|
return false;">reload this page</a>
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
@ -0,0 +1,26 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
# This code was taken from Pi-Star (and maybe modified a bit)
|
||||||
|
# https://github.com/AndyTaylorTweet/Pi-Star_Binaries_sbin/blob/master/pistar-hourly.cron
|
||||||
|
|
||||||
|
echo -n "Shrinking MMDVM log..."
|
||||||
|
# Shrink the MMDVMHost Log
|
||||||
|
MMDVMLogFiles=$(ls /var/log/mmdvm/MMDVM-*.log 2> /dev/null | wc -l)
|
||||||
|
if [[ "$MMDVMLogFiles" != "0" ]]; then
|
||||||
|
todayMMDVMLog=$(ls -1rt /var/log/mmdvm/MMDVM-*.log | tail -n1)
|
||||||
|
modemLine=$(grep "MMDVM protocol version" ${todayMMDVMLog} | tail -n 1)
|
||||||
|
if [ "$(head -n 1 ${todayMMDVMLog})" = "${modemLine}" ]; then
|
||||||
|
sed -i '1d' ${todayMMDVMLog}
|
||||||
|
fi
|
||||||
|
echo -e "${modemLine}\n$(egrep -h "from|end|watchdog|lost|protocol" ${todayMMDVMLog} | sed '/(CSBK|overflow|mapping points|Downlink)/d' | tail -n 500)" > ${todayMMDVMLog}
|
||||||
|
#echo -e "${modemLine}\n$(egrep -h "from|end|watchdog|lost|protocol" ${todayMMDVMLog} | sed '/(CSBK|overflow|mapping points|Downlink)/d' | tail -n 1000)" > ${todayMMDVMLog}
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo -n " /var/log..."
|
||||||
|
# Clean up systemd logs
|
||||||
|
journalctl --rotate > /dev/null 2>&1
|
||||||
|
#journalctl --vacuum-time=24h
|
||||||
|
#journalctl --vacuum-size=5M
|
||||||
|
journalctl --vacuum-time=6h > /dev/null 2>&1
|
||||||
|
journalctl --vacuum-size=2M > /dev/null 2>&1
|
||||||
|
|
||||||
|
echo " OK"
|
Before Width: | Height: | Size: 70 KiB After Width: | Height: | Size: 55 KiB |
Loading…
Reference in new issue