Skip to content
Snippets Groups Projects
Verified Commit fb41f2ec authored by David Beniamine's avatar David Beniamine
Browse files

Small fixes

parent 51055e6e
No related branches found
No related tags found
No related merge requests found
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
IP=$(ip a | awk '/inet.*containers/ {print $2}' | cut -d / -f 1) IP=$(ip a | awk '/inet.*containers/ {print $2}' | cut -d / -f 1)
netcat="netcat -l $IP 9999" netcat="netcat -l $IP 9999"
KPID=`ps aux | grep \'$netcat\' | awk '{print $2}'` KPID=`ps aux | grep \'$netcat\' | awk '{print $2}'`
[ ! -z "$PID" ] && kill $PID [ ! -z "$KPID" ] && kill $KPID
subnet=$(ip a | awk '/inet.*containers/ {print $2}' | cut -d / -f 1 | cut -d . -f 1-3) subnet=$(ip a | awk '/inet.*containers/ {print $2}' | cut -d / -f 1 | cut -d . -f 1-3)
echo "$1" | netcat $subnet.52 9999 echo "$1" | netcat $subnet.52 9999
......
...@@ -24,9 +24,9 @@ getip(){ ...@@ -24,9 +24,9 @@ getip(){
IP=$(ip a | awk '/inet.*containers/ {print $2}' | cut -d / -f 1) IP=$(ip a | awk '/inet.*containers/ {print $2}' | cut -d / -f 1)
broadcast=$(ip a | awk '/inet.*eth1/ {print $4}' | cut -d / -f 1) broadcast=$(ip a | awk '/inet.*eth1/ {print $4}' | cut -d / -f 1)
subnet=$(ip a | awk '/inet.*containers/ {print $2}' | cut -d / -f 1 | cut -d . -f 1-3) subnet=$(ip a | awk '/inet.*containers/ {print $2}' | cut -d / -f 1 | cut -d . -f 1-3)
netcat -k -l $IP 9999 | \ while true
while read MAC
do do
MAC=`netcat -k -l $IP 9999`
if [ $(echo "$MAC" | egrep -c "^([0-9a-f]{2}:?){6}$") -eq 1 ] if [ $(echo "$MAC" | egrep -c "^([0-9a-f]{2}:?){6}$") -eq 1 ]
then then
wakeonlan -i $broadcast "$MAC" wakeonlan -i $broadcast "$MAC"
...@@ -40,4 +40,3 @@ netcat -k -l $IP 9999 | \ ...@@ -40,4 +40,3 @@ netcat -k -l $IP 9999 | \
echo "$bootedip" | netcat $subnet.51 9999 echo "$bootedip" | netcat $subnet.51 9999
fi fi
done done
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment