Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
freedombone
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Context Sensitive Group
freedombone
Commits
f74341bf
Commit
f74341bf
authored
6 years ago
by
Bob Mottram
Browse files
Options
Downloads
Patches
Plain Diff
Daemon to restart mesh networking when ethernet is connected
parent
5357e59f
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/freedombone-image-mesh
+27
-0
27 additions, 0 deletions
src/freedombone-image-mesh
src/freedombone-mesh-ethernet
+42
-0
42 additions, 0 deletions
src/freedombone-mesh-ethernet
with
69 additions
and
0 deletions
src/freedombone-image-mesh
+
27
−
0
View file @
f74341bf
...
...
@@ -867,6 +867,7 @@ function mesh_restart_daemons {
systemctl restart avahi-daemon
systemctl restart tox-bootstrapd
systemctl restart nginx
systemctl restart ethmesh
echo
$'Daemons restarted'
>>
$INSTALL_LOG
}
...
...
@@ -1330,6 +1331,31 @@ function initialise_scuttlebot_pub {
fi
}
function
mesh_ethernet_daemon
{
if
[
-f
/etc/systemd/system/ethmesh.service
]
;
then
return
fi
{
echo
'[Unit]'
;
echo
'Description=Ethernet daemon for mesh'
;
echo
'After=network.target'
;
echo
''
;
echo
'[Service]'
;
echo
'User=root'
;
echo
"ExecStart=/usr/local/bin/
${
PROJECT_NAME
}
-mesh-ethernet"
;
echo
"ExecReload=/bin/kill
\$
MAINPID"
;
echo
'KillMode=process'
;
echo
'Restart=always'
;
echo
''
;
echo
'[Install]'
;
echo
'WantedBy=multi-user.target'
;
}
>
/etc/systemd/system/ethmesh.service
systemctl
enable
ethmesh
systemctl daemon-reload
systemctl start ethmesh
}
# whether to reset the identity
set_new_identity
=
if
[
"
$2
"
]
;
then
...
...
@@ -1449,6 +1475,7 @@ if [ -f $MESH_INSTALL_SETUP ]; then
enable_peertube
mesh_amnesic
make_root_read_only
mesh_ethernet_daemon
if
[
!
-f
$MESH_AMNESIC
]
;
then
rm
$MESH_INSTALL_SETUP
...
...
This diff is collapsed.
Click to expand it.
src/freedombone-mesh-ethernet
0 → 100755
+
42
−
0
View file @
f74341bf
#!/bin/bash
# _____ _ _
# | __|___ ___ ___ _| |___ _____| |_ ___ ___ ___
# | __| _| -_| -_| . | . | | . | . | | -_|
# |__| |_| |___|___|___|___|_|_|_|___|___|_|_|___|
#
# Freedom in the Cloud
#
# Daemon which monitors whether ethernet is connected or not
#
# License
# =======
#
# Copyright (C) 2018 Bob Mottram <bob@freedombone.net>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 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 Affero General Public License for more details.
#
# 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/>.
ETHERNET_ATTACHED
=
/sys/class/net/eth0/carrier
prev_eth_attached
=
$(
cat
$ETHERNET_ATTACHED
)
while
true
do
sleep
5
eth_attached
=
$(
cat
$ETHERNET_ATTACHED
)
if
[[
"
$eth_attached
"
!=
"
$prev_eth_attached
"
]]
;
then
/usr/local/bin/batman restart
fi
prev_eth_attached
=
$eth_attached
done
exit
0
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment