Python port listen

import socket
import subprocess
host = ""
port = 8888
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM | socket.SO_REUSEADDR)
s.bind((host, port))
while 1:
  data, addr = s.recvfrom(1024)
  if data == 'wakeonlan':["/usr/bin/wakeonlan", "-i", "", "08:60:6e:6c:be:d8"])

Run Python script at startup:

sudo crontab -e
@reboot python /home/pi/ &

The & at the end of the line means the command is run in the background and it won’t stop the system booting up.