Skip to content
Snippets Groups Projects
Commit 4b19fc06 authored by Bob Mottram's avatar Bob Mottram
Browse files

Stopping mesh protocol before starting another

parent 73dd4018
No related branches found
No related tags found
No related merge requests found
...@@ -97,6 +97,10 @@ function stop { ...@@ -97,6 +97,10 @@ function stop {
disable_mesh_firewall disable_mesh_firewall
systemctl restart network-manager systemctl restart network-manager
if [ -f $MESH_CURRENT_PROTOCOL ]; then
rm $MESH_CURRENT_PROTOCOL
fi
} }
function verify { function verify {
...@@ -152,6 +156,8 @@ function start { ...@@ -152,6 +156,8 @@ function start {
fi fi
echo "info: enabling batman-adv mesh network $WIFI_SSID on $IFACE" echo "info: enabling batman-adv mesh network $WIFI_SSID on $IFACE"
mesh_protocol_stop
systemctl stop network-manager systemctl stop network-manager
sleep 5 sleep 5
...@@ -225,6 +231,8 @@ function start { ...@@ -225,6 +231,8 @@ function start {
systemctl restart nginx systemctl restart nginx
verify verify
echo "batman-adv" > $MESH_CURRENT_PROTOCOL
} }
function monitor { function monitor {
......
...@@ -87,6 +87,10 @@ function stop { ...@@ -87,6 +87,10 @@ function stop {
disable_mesh_firewall disable_mesh_firewall
systemctl restart network-manager systemctl restart network-manager
if [ -f $MESH_CURRENT_PROTOCOL ]; then
rm $MESH_CURRENT_PROTOCOL
fi
} }
function verify { function verify {
...@@ -133,7 +137,8 @@ function start { ...@@ -133,7 +137,8 @@ function start {
fi fi
echo "info: enabling BMX6 mesh network $WIFI_SSID on $IFACE" echo "info: enabling BMX6 mesh network $WIFI_SSID on $IFACE"
batman stop mesh_protocol_stop
systemctl stop network-manager systemctl stop network-manager
sleep 5 sleep 5
...@@ -207,6 +212,8 @@ function start { ...@@ -207,6 +212,8 @@ function start {
systemctl restart nginx systemctl restart nginx
verify verify
echo "bmx6" > $MESH_CURRENT_PROTOCOL
} }
function monitor { function monitor {
......
...@@ -28,6 +28,25 @@ ...@@ -28,6 +28,25 @@
# You should have received a copy of the GNU Affero General Public License # 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/>. # 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 { function mesh_protocol_init {
if [[ $1 == "start" ]]; then if [[ $1 == "start" ]]; then
# install avahi # install avahi
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment