mirror of
https://github.com/lloeki/toolbelt.git
synced 2025-12-06 10:04:40 +01:00
a few scripts
This commit is contained in:
commit
b9948f0dae
9 changed files with 479 additions and 0 deletions
38
keep_en0_alive.sh
Executable file
38
keep_en0_alive.sh
Executable file
|
|
@ -0,0 +1,38 @@
|
|||
#!/bin/bash
|
||||
|
||||
[ "$UID" == 0 ] || exec sudo $0
|
||||
|
||||
TARGET='10.0.100.254'
|
||||
TIMEOUT='5'
|
||||
|
||||
kext='/System/Library/Extensions/BCM5722D.kext'
|
||||
|
||||
std_date() {
|
||||
echo -n $(date +'%Y-%m-%d %H:%M:%S')
|
||||
}
|
||||
|
||||
is_up() {
|
||||
ping -q -t $TIMEOUT -o -r $TARGET > /dev/null
|
||||
}
|
||||
|
||||
wait_for_up() {
|
||||
ping -q -o -r $TARGET > /dev/null
|
||||
}
|
||||
|
||||
restart_iface() {
|
||||
echo "syncing"
|
||||
sync
|
||||
echo "unloading kext"
|
||||
kextunload $kext
|
||||
echo "loading kext"
|
||||
kextload $kext
|
||||
}
|
||||
|
||||
while wait_for_up; do
|
||||
while is_up; do
|
||||
sleep 1
|
||||
done
|
||||
|
||||
echo "en0 down @ `std_date`"
|
||||
restart_iface
|
||||
done
|
||||
Loading…
Add table
Add a link
Reference in a new issue