jozicka
Posts: 4
Joined: Fri Oct 28, 2016 8:56 pm

PI as wakeUP server, alternative way-without router access

Fri Oct 28, 2016 9:11 pm

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.
Last edited by jozicka on Sun Oct 30, 2016 7:24 pm, edited 1 time in total.

User avatar
lmarmisa
Posts: 1220
Joined: Thu Feb 14, 2013 2:22 am
Location: Jávea, Spain

Re: PI as wakeUP server, alternative way

Sat Oct 29, 2016 4:35 am

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

jozicka
Posts: 4
Joined: Fri Oct 28, 2016 8:56 pm

Re: PI as wakeUP server, alternative way

Sat Oct 29, 2016 2:27 pm

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 ☺
Last edited by jozicka on Sat Oct 29, 2016 7:34 pm, edited 1 time in total.

User avatar
thagrol
Posts: 850
Joined: Fri Jan 13, 2012 4:41 pm
Location: Darkest Somerset, UK
Contact: Website

Re: PI as wakeUP server, alternative way

Sat Oct 29, 2016 4:03 pm

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
Note to self: don't feed the trolls
If you believe "L'enfer, c'est les autres" (Hell is other people) have you considered that it may be of your own making?

jozicka
Posts: 4
Joined: Fri Oct 28, 2016 8:56 pm

Re: PI as wakeUP server, alternative way

Sun Oct 30, 2016 7:23 pm

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 )

depauw
Posts: 44
Joined: Mon Nov 09, 2015 2:12 pm

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

Mon Oct 31, 2016 8:10 am

Very clever workaround!!!!
Well done!

jozicka
Posts: 4
Joined: Fri Oct 28, 2016 8:56 pm

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

Sun Dec 04, 2016 2:27 pm

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 ☺

Return to “General discussion”

Who is online

Users browsing this forum: No registered users and 35 guests