Tag Archives: php

Wake on LAN for PC’s via Raspberry Pi

I found a nice PHP script for Wake on LAN. I loaded it on the Raspberry Pi that I have and configured it for my system. The Raspberry Pi runs 24/7, so I can just navigate to a web page that it serves, hit a button and start up one of my machines at home from anywhere. Mostly this is useful for the starting my Linux file server remotely but I do use it to fire off the desktop too.

Right from the read me file for the code…

REMOTE WAKE/SLEEP-ON-LAN SERVER
=========================
This is simple webapp that runs on your Raspberry Pi to turn it into a remotely accessible Wake/Sleep-On-LAN Server. [Follow the detailed tutorial](http://www.jeremyblum.com/2013/07/14/rpi-wol-server/) on my website for instructions on how to get this working, and forwarded through a router. This is very useful when you have high-powered machine that you don’t want to keep on all the time, but that you want to keep remotely accessible for Remote Desktop, SSH, FTP, etc.

http://www.jeremyblum.com/2013/07/14/rpi-wol-server/

Results

It is rare when something works right out of the box. But, this did, I followed Jeremy Blum’s instructions and within a few minutes I had this working. It has a nice drop-down menu where you can select a computer. It pings it to see if it is awake, then you can wake it from anywhere in the world. Once the WOL packet is sent, the application keeps pinging the PC at a defined interval and you can see when it wakes. I have not tried the sleep functionality as I am using it with Linux PC’s and his outline covers Windows machines. I am sure the code could me modified to shut down a Linux PC somehow. Perhaps it automatically SSH’s in and sends a shutdown command, something like that. I have my Linux server set to shutdown automatically so I don’t need this functionality myself.

It is configurable through an easily understood config.php file as well. You can set the computers name and IP address, MAC address, timing between pings, amount of times to ping the machine and etc.

Also see on this site…

Original Wake on LAN via Ubuntu Linux Post

Windows Wake on LAN Post

Configuring Posting via email for WordPress

I am testing out the ability to post via a secret email, this is how I created this post, then edited some more in WP.

I fussed with it for a bit, sending emails and expecting results. I didn’t realize that the email reading for WP has to be stroked. So I put together a cron job to stroke the reading of email periodically (daily for the moment, which seems reasonable) via php
using…

php -q /home/yourcpanelusername/path-to-folder/wp-mail.php

Which didn’t work, initially. I kept getting email via cron which has XML in the body, it is an error with a line at the bottom…

<p>Slow down cowboy, no need to check for new mails so often!</p>

Then I tried this

But manually stroking the email by going to the URL where wp-mail.php lives does kick the email to a post as lists it as pending. This in my mind is not terribly useful. I would prefer to send an email and have not be a pending post as I would like to post from email without needing to login to WP, in other words just post it already.

Mysteriously after experimenting with sending a few posts by email, it started to work. I sm not sure why, but checking the mail daily at 1AM, it either gets the messages, creates a pending post and deletes the copies on the mail server as it should and reports this in a CRON email. Or there are no emails for it and it reports that correctly. After an initial weirdness it has been working fine and as expected for several weeks.