Bash WakeOnLan with Nmap - Raspberry Pi Forums
hi guys,
terrible @ programming
can please me script? ultimate goal script make sure nmap , wakeonlan installed, send magic packet mac address , ran nmap pipe ip of mac address variable , ping confirm.
got far:
part struggle piping of ip mac ping it.
ideas please on how set ip variable 192.168.2.21 can use in ping test?
terrible @ programming
got far:
code: select all
#!/bin/bash ip=sudo nmap -sp 192.168.2.0/24 | awk '/00:24:8c:fd:f9:3e/{print $3;}' | sort clear # first check if pv package installed, if not, install first packagestatus=`dpkg -s wakeonlan | grep status`; if [[ $packagestatus == s* ]] echo "package 'wakeonlan' installed." else echo "package 'wakeonlan' not installed." echo "installing package 'wakeonlan'. please wait..." apt-get -y install wakeonlan fi packagestatus=`dpkg -s nmap | grep status`; if [[ $packagestatus == s* ]] echo "package 'nmap' installed." else echo "package 'nmap' not installed." echo "installing package 'nmap'. please wait..." apt-get -y install nmap fi echo "sending wol packets computer" wakeonlan 00:24:8c:fd:f9:3e echo "testing if computer awake" sleep 2m ping -c 1 -t 1 ip && echo "computer up!" code: select all
sudo nmap -sp 192.168.2.0/24 | awk '/00:24:8c:fd:f9:3e/{print $3;}' | sort
any ideas? 
raspberrypi
Comments
Post a Comment