#!/bin/bash # * Check status en zet LEDS # * # * # * Versie 1.00 # * # * Copyright (C) 2017, Lieven, ON7LDS. All rights reserved # * # * This program is free software; you can redistribute it and/or modify # * it under the terms of the GNU General Public License as published by # * the Free Software Foundation; either version 2 of the License, or # * (at your option) any later version. # * # * This program is distributed in the hope that it will be useful, # * but WITHOUT ANY WARRANTY; without even the implied warranty of # * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # * GNU General Public License for more details. # * # */ # hiervoor is de wiringpi bibliotheek nodig, doe: # apt-get install wiringpi # waar staan de MMDVMHost logfiles ? LOGDIR="/opt/MMDVMHost" gpio mode 27 out gpio mode 28 out while [ 1 ]; do ######### is er netwerk ? (bekabeld of draadloos) let WLAN=$(ip a show wlan0 2>/dev/null | wc -l) let ETH=$(ip a show eth0 2>/dev/null | wc -l) # echo "$WLAN $ETH" NET=0; if [ "$WLAN" -gt 3 ]; then let NET=NET+1; fi if [ "$ETH" -gt 3 ]; then let NET=NET+1; fi # echo "NET $NET" if [ "$NET" -gt 0 ]; then gpio write 28 1; else gpio write 28 0; fi ######### is er een verbinding met BM ? ######### Lokglevel DATUM=$(date +"%Y-%m-%d") DMR=$(cat $LOGDIR/MMDVM-$DATUM.log 2>/dev/null | grep 'master\|DVMega\|exit' | tail -n 1 | grep success | wc -l) # echo "DMR = $DMR" if [ "$DMR" -gt 0 ]; then gpio write 27 1; else gpio write 27 0; fi ######### sleep 2 done