Stopping mesh protocol before starting another

This commit is contained in:
Bob Mottram 2018-01-13 11:36:50 +00:00
parent 73dd40180a
commit 4b19fc06ea
3 changed files with 35 additions and 1 deletions

View File

@ -97,6 +97,10 @@ function stop {
disable_mesh_firewall
systemctl restart network-manager
if [ -f $MESH_CURRENT_PROTOCOL ]; then
rm $MESH_CURRENT_PROTOCOL
fi
}
function verify {
@ -152,6 +156,8 @@ function start {
fi
echo "info: enabling batman-adv mesh network $WIFI_SSID on $IFACE"
mesh_protocol_stop
systemctl stop network-manager
sleep 5
@ -225,6 +231,8 @@ function start {
systemctl restart nginx
verify
echo "batman-adv" > $MESH_CURRENT_PROTOCOL
}
function monitor {

View File

@ -87,6 +87,10 @@ function stop {
disable_mesh_firewall
systemctl restart network-manager
if [ -f $MESH_CURRENT_PROTOCOL ]; then
rm $MESH_CURRENT_PROTOCOL
fi
}
function verify {
@ -133,7 +137,8 @@ function start {
fi
echo "info: enabling BMX6 mesh network $WIFI_SSID on $IFACE"
batman stop
mesh_protocol_stop
systemctl stop network-manager
sleep 5
@ -207,6 +212,8 @@ function start {
systemctl restart nginx
verify
echo "bmx6" > $MESH_CURRENT_PROTOCOL
}
function monitor {

View File

@ -28,6 +28,25 @@
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# File which contains the current protocol in use
MESH_CURRENT_PROTOCOL=~/.mesh_protocol
function mesh_protocol_stop {
if [ ! -f $MESH_CURRENT_PROTOCOL ]; then
return
fi
if grep -q "bmx6" $MESH_CURRENT_PROTOCOL; then
bmx stop
fi
if grep -q "batman-adv" $MESH_CURRENT_PROTOCOL; then
batman stop
fi
rm $MESH_CURRENT_PROTOCOL
}
function mesh_protocol_init {
if [[ $1 == "start" ]]; then
# install avahi