Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
G
Gluon SSID Changer
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
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
firmware
Gluon SSID Changer
Commits
9cd44be8
Commit
9cd44be8
authored
7 years ago
by
rubo77
Browse files
Options
Downloads
Patches
Plain Diff
Add enabled option
parent
5d0258fe
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
files/lib/gluon/ssid-changer/ssid-changer.sh
+9
-3
9 additions, 3 deletions
files/lib/gluon/ssid-changer/ssid-changer.sh
with
9 additions
and
3 deletions
files/lib/gluon/ssid-changer/ssid-changer.sh
+
9
−
3
View file @
9cd44be8
...
@@ -4,6 +4,12 @@ MINUTES=1440 # only once every timeframe the SSID will change to OFFLINE (set to
...
@@ -4,6 +4,12 @@ MINUTES=1440 # only once every timeframe the SSID will change to OFFLINE (set to
FIRST
=
5
# the first few minutes directly after reboot within which an Offline-SSID always may be activated
FIRST
=
5
# the first few minutes directly after reboot within which an Offline-SSID always may be activated
OFFLINE_PREFIX
=
'FF_OFFLINE_'
# use something short to leave space for the nodename (no '~' allowed!)
OFFLINE_PREFIX
=
'FF_OFFLINE_'
# use something short to leave space for the nodename (no '~' allowed!)
if
[
"
$(
uci get ssid-changer.settings.enabled
-q
)
"
=
'0'
]
;
then
DISABLED
=
'1'
else
DISABLED
=
'0'
fi
ONLINE_SSID
=
"
$(
uci get wireless.client_radio0.ssid
-q
)
"
ONLINE_SSID
=
"
$(
uci get wireless.client_radio0.ssid
-q
)
"
:
${
ONLINE_SSID
:
=
"FREIFUNK"
}
# if for whatever reason ONLINE_SSID is NULL
:
${
ONLINE_SSID
:
=
"FREIFUNK"
}
# if for whatever reason ONLINE_SSID is NULL
...
@@ -18,9 +24,9 @@ else
...
@@ -18,9 +24,9 @@ else
fi
fi
# maximum simplified, no more ttvn rating
# maximum simplified, no more ttvn rating
CHECK
=
$(
batctl gwl
-H
|grep
-v
"gateways in range"
|wc
-l
)
CHECK
=
"
$(
batctl gwl
-H
|grep
-v
"gateways in range"
|wc
-l
)
"
HUP_NEEDED
=
0
HUP_NEEDED
=
0
if
[
$CHECK
-gt
0
]
;
then
if
[
"
$CHECK
"
-gt
0
]
||
[
"
$DISABLED
"
=
'1'
]
;
then
echo
"node is online"
echo
"node is online"
for
HOSTAPD
in
$(
ls
/var/run/hostapd-phy
*
)
;
do
# check status for all physical devices
for
HOSTAPD
in
$(
ls
/var/run/hostapd-phy
*
)
;
do
# check status for all physical devices
CURRENT_SSID
=
"
$(
grep
"^ssid=
$ONLINE_SSID
"
$HOSTAPD
|
cut
-d
"="
-f2
)
"
CURRENT_SSID
=
"
$(
grep
"^ssid=
$ONLINE_SSID
"
$HOSTAPD
|
cut
-d
"="
-f2
)
"
...
@@ -38,7 +44,7 @@ if [ $CHECK -gt 0 ]; then
...
@@ -38,7 +44,7 @@ if [ $CHECK -gt 0 ]; then
echo
"There is something wrong, did not find SSID
$ONLINE_SSID
or
$OFFLINE_SSID
"
echo
"There is something wrong, did not find SSID
$ONLINE_SSID
or
$OFFLINE_SSID
"
fi
fi
done
done
elif
[
$CHECK
-eq
0
]
;
then
elif
[
"
$CHECK
"
-eq
0
]
;
then
echo
"node is considered offline"
echo
"node is considered offline"
UP
=
$(
cat
/proc/uptime |
sed
's/\..*//g'
)
UP
=
$(
cat
/proc/uptime |
sed
's/\..*//g'
)
if
[
$((
$UP
/
60
))
-lt
$FIRST
]
||
[
$((
$UP
/
60
%
$MINUTES
))
-eq
0
]
;
then
if
[
$((
$UP
/
60
))
-lt
$FIRST
]
||
[
$((
$UP
/
60
%
$MINUTES
))
-eq
0
]
;
then
...
...
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