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:

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!" 
part struggle piping of ip mac ping it.

code: select all

sudo nmap -sp 192.168.2.0/24 | awk '/00:24:8c:fd:f9:3e/{print $3;}' | sort
ideas please on how set ip variable 192.168.2.21 can use in ping test?

any ideas? :)


raspberrypi



Comments

Popular posts from this blog

How do I add a forum to my site? - Joomla! Forum - community, help and support

VIDIOC_S_FMT error 16, Device or resource busy - Raspberry Pi Forums

List Control