From 44af024525bb2813447cf21bf0ac64f98e8f14b2 Mon Sep 17 00:00:00 2001 From: David Beniamine <david.beniamine@tetras-libre.fr> Date: Thu, 2 Aug 2018 08:29:43 +0200 Subject: [PATCH] =?UTF-8?q?WIP=C2=A0:=20return=20booted=20ip?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- wol/scripts/sendmac.sh | 2 ++ wol/scripts/wakeonlanservice.sh | 5 +++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/wol/scripts/sendmac.sh b/wol/scripts/sendmac.sh index ce6ca56..9a8d206 100755 --- a/wol/scripts/sendmac.sh +++ b/wol/scripts/sendmac.sh @@ -16,5 +16,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. +IP=$(ip a | awk '/inet.*containers/ {print $2}' | cut -d / -f 1) subnet=$(ip a | awk '/inet.*containers/ {print $2}' | cut -d / -f 1 | cut -d . -f 1-3) echo "$1" | netcat $subnet.52 9999 +netcat -l $IP 9999 diff --git a/wol/scripts/wakeonlanservice.sh b/wol/scripts/wakeonlanservice.sh index 1c2949d..97889da 100755 --- a/wol/scripts/wakeonlanservice.sh +++ b/wol/scripts/wakeonlanservice.sh @@ -18,14 +18,15 @@ IP=$(ip a | awk '/inet.*containers/ {print $2}' | 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) netcat -k -l $IP 9999 | \ while read MAC do if [ $(echo "$MAC" | egrep -c "^([0-9a-f]{2}:?){6}$") -eq 1 ] then wakeonlan -i $broadcast "$MAC" + bootedip=`arp | grep "$MAC" | awk '{print $3}'` + echo "$bootedip" | netcat $subnet.51 9999 fi done - - -- GitLab