Page 1 of 1

PI as wakeUP server, alternative way-without router access

Posted: Fri Oct 28, 2016 9:11 pm
by jozicka
Hi,
I would like to use my PI as wake-up server in my network, however I do not have access to router, and also my IP is not public.

So I have a idea to have a alternative way, using of possibility to map of Gdrive or other cloud storage.

The idea is simple - schedule job on PI that will every minute run script for if file present on Gdrive ( something like: if exist /mnt/..../WAKEUP/PC1.txt then send wake up command to PC1 etc).

So if I from my mobile put a file named PC1 under folder WAKEUP to a Gdrive, my PI will within one minute wakeup a PC1.

Do you thing this way is possible? I'm not good with setting up anything on PI - It takes me ages to find out proper guidelines, and then get lost in the middle, so I'm asking before I start, If there is not a bug in my plan.

What do you think? (and sorry for my bad english)
J.

Re: PI as wakeUP server, alternative way

Posted: Sat Oct 29, 2016 4:35 am
by lmarmisa
Your project seems feasible.

If you need a wol client, install the package wakeonlan:

Code: Select all

sudo apt-get install wakeonlan

Code: Select all

wakeonlan 00:11:22:33:44:55

Re: PI as wakeUP server, alternative way

Posted: Sat Oct 29, 2016 2:27 pm
by jozicka
Thank you for tip. I'm out of the city now, but when I get back, I will try to set it up and update the result ☺

Re: PI as wakeUP server, alternative way

Posted: Sat Oct 29, 2016 4:03 pm
by thagrol
If you're going to be working in python and don't want to use an external tool, have a look at my code here: https://github.com/thagrol/fakewake

Specifically the functions make_packet and pack_mac in fakewake.py

Re: PI as wakeUP server, alternative way

Posted: Sun Oct 30, 2016 7:23 pm
by jozicka
SUPERB!! IT works :)

I have attached google drive using GDriveFS
I have Installed WAKEONLAN tool

I have created a simple script WAKE.BAT (sorry, bad habit from NT commands):

if ls /mnt/gdrivefs/PI/PC1.txt 1> /dev/null 2>&1; then
wakeonlan aa:bb:cc:dd:ee:ff
mv /mnt/gdrivefs/PI/PC1.txt /mnt/gdrivefs/PI/WPC1.txt
else
echo "files do not exist"
fi

and I set in crontab job to execute it every minute (may be I can swith to every 5 minutes)
*/1 * * * * /home/pi/Desktop/WAKE.bat

So if I put under G drive in PI folder file named PC1.txt, it will wake my local network pc, and rename the file to WPC1.txt

I know it is very simple, but working :) As I do not have access to router and my IP is not public one, I guess this is the only way to go ..

(In fact it would be no problem to use this way as a terminal communication - if exist /PI/RUN.bat, execute it , output put to RESULT.txt and rename RUN.bat to DONE.bat... but wakeup is just enough for me )

Re: PI as wakeUP server, alternative way-without router acce

Posted: Mon Oct 31, 2016 8:10 am
by depauw
Very clever workaround!!!!
Well done!

Re: PI as wakeUP server, alternative way-without router acce

Posted: Sun Dec 04, 2016 2:27 pm
by jozicka
Small update - I have found the gdrivefs very unstable and taking too much memory.
Due to that I switched to fetchmail solution. Pi every 5 minutes checks emails and if subject is wakeup then it sends signal to wake pc... Now it works properly ☺