rasprm3
Posts: 195
Joined: Sun Jan 20, 2013 1:27 am

Re: Raspberry pi as a Wake on Lan source

Sat Jan 26, 2013 1:20 am

Hmm. Must be a 30 min timout on editing posts...

Another newbie question... What's the best way to power down a Raspberry Pi? I got the impression there's no off switch so you just unplug it. Doesn't quite sound safe though.

rasprm3
Posts: 195
Joined: Sun Jan 20, 2013 1:27 am

Re: Raspberry pi as a Wake on Lan source

Sat Jan 26, 2013 3:26 am

Hmm. How would you delete a cron job?

Say I set 6am was a wake on lan time, but later changed my mind and wanted it to be 615am instead?



Found this...
http://forums.webhostingdiscussion.net/ ... 294.0.html
But can I delete just one entry? Not my whole user list of cron jobs?


rasprm3
Posts: 195
Joined: Sun Jan 20, 2013 1:27 am

Re: Raspberry pi as a Wake on Lan source

Sat Jan 26, 2013 4:22 am

And I see Allied has the power supply. I was wondering.

Which is better, Allied or RS? I'm in the US.


I'm not sure about the Allied white power supply connected with usb to micro usb. Is the RS power supply any advantage if it's all one unit? (Haha... And it's black. Less conspicuous that way. I plan to tuck this on a shelf and forget about it.)

I don't want to futz up the power. I would assume the power supply sold on Allied or RS should work just finie. As opposed to me hunting something else down somewhere.

User avatar
DeeJay
Posts: 2027
Joined: Tue Jan 01, 2013 9:33 pm
Location: East Midlands, UK

Re: Raspberry pi as a Wake on Lan source

Sat Jan 26, 2013 9:50 am

rasprm3 wrote:What's the best way to power down a Raspberry Pi? I got the impression there's no off switch so you just unplug it. Doesn't quite sound safe though.
Correct. That's not safe. There is a chance that the SD card could become corrupted, making it impossible to reboot.

Opinions vary as to the 'best' way to stop the operating system before removing the power, but my choice is -

Code: Select all

sudo shutdown -h now
This is documented in 'man shutdown' which explains how to schedule a shutdown for a specified time.
How To Ask Questions The Smart Way: http://www.catb.org/~esr/faqs/smart-questions.html
How to Report Bugs Effectively: http://www.chiark.greenend.org.uk/~sgtatham/bugs.html

rasprm3
Posts: 195
Joined: Sun Jan 20, 2013 1:27 am

Re: Raspberry pi as a Wake on Lan source

Sun Jan 27, 2013 1:02 am

I started a post over here, looking for the right SD card...

http://www.raspberrypi.org/phpBB3/viewt ... 26&t=31219

It's more work to find the SD card then it is to pick out a Pi or even generally plan the whole thing out.

rasprm3
Posts: 195
Joined: Sun Jan 20, 2013 1:27 am

Re: Raspberry pi as a Wake on Lan source

Sun Jan 27, 2013 1:32 am

I'm surprised and much more aware how static my schedule is. I'm setting a device to turn my computer on for my set schedule. And that idea works.

I was thinking.... It's probably possible, but not my project, to use GPS on a phone to detect when you're home. If you're home, the Raspberry Pi makes sure your computer is powered on. When you leave, it could power it down. Just an idea. I'm not interested in messing with that though. It does avoid the staticness of how I'm scheduling with this alarm clock idea.

rasprm3
Posts: 195
Joined: Sun Jan 20, 2013 1:27 am

Re: Raspberry pi as a Wake on Lan source

Sun Jan 27, 2013 3:04 am

I was wondering about this. For whatever SD card I get, I'll probably have resize the partition?
http://elsmorian.com/post/23366148056/b ... y-pi-setup

Or can I set it up initially to use all the available space?

rasprm3
Posts: 195
Joined: Sun Jan 20, 2013 1:27 am

Re: Raspberry pi as a Wake on Lan source

Sun Jan 27, 2013 3:13 am

Is there any advantage or disadvantage to the SD card size?

At least 2GB for the OS, so probably 4GB minimum to be safe, right?

But then... 8, 16, 32 GB? The only things I've found is that extra space can mean a faster write if you have something where that's an issue. And just having extra space if needed is nice.

If I have a choice between 8 and 16GB, is there really any difference?

User avatar
rpdom
Posts: 14768
Joined: Sun May 06, 2012 5:17 am
Location: Chelmsford, Essex, UK

Re: Raspberry pi as a Wake on Lan source

Sun Jan 27, 2013 9:18 am

Go for the biggest card you can comfortably afford. Don't take the chance of running out of space, and it's always good to have more in case you need it for another project later on :)

Yes, you will have to resize the partition. The image is built to fit on the smallest feasible card it can. Resizing is easy, form the initial config menu, it just needs a reboot (when told to) and a bit of time to finish (your Pi will be usable after the reboot, but slow while it is performing the resize task in the background.

I used other methods to resize my cards, but I'm very familiar with *nix operating systems, especially the command line, having worked on them for nearly 20 years now. I actually use an old 16MB card for some testing :shock:

Your GPS driven alarm idea sounds like an interesting project. It would take some work though.

rasprm3
Posts: 195
Joined: Sun Jan 20, 2013 1:27 am

Re: Raspberry pi as a Wake on Lan source

Tue Jan 29, 2013 1:36 am

Ordered a Pi. 1 28 2013.

RS shuffled me over to Allied. They're back ordered. Now I have to wait.

I'll just get the rest of the stuff through Amazon sometime over the next month or so. No rush now.

rasprm3
Posts: 195
Joined: Sun Jan 20, 2013 1:27 am

Re: Raspberry pi as a Wake on Lan source

Sat Feb 09, 2013 6:24 pm

Hmm. Another question....

I read the Raspberry Pi doesn't have its own real time clock.

Is it just a matter of connecting it to the network after its been powered off and then it will know the correct time/date?

The important question -- I was planning on leaving the raspberry pi on all the time. I would assume once it's got the time/date, it would keep it. I am planning on turning the router off though like I usually do. The raspberry pi will still keep its time/date, right? It's not completely relying on the router/network to find the time/date?

It looks like there are options for adding an RTC clock. More involved, but if I have to do that, that's the only way... Hopefully it will keep its time/date as long as its got power.

User avatar
rpdom
Posts: 14768
Joined: Sun May 06, 2012 5:17 am
Location: Chelmsford, Essex, UK

Re: Raspberry pi as a Wake on Lan source

Sat Feb 09, 2013 7:01 pm

As long as the Pi has an internet connection it will automatically set its clock from one of the many NTP servers when it boots. If not, it will either use the last date/time it remembers, or default to 00:01 01 Jan 1970.

The realtime clock add-on is only really needed if running without an internet connection, or it can't connect to any of the NTP servers.

rasprm3
Posts: 195
Joined: Sun Jan 20, 2013 1:27 am

Re: Raspberry pi as a Wake on Lan source

Thu Mar 14, 2013 11:17 pm

Hey, hey. Pi Day... And my Raspberry Pi showed up.
:lol: :roll:
Now I can get back to this project....

rasprm3
Posts: 195
Joined: Sun Jan 20, 2013 1:27 am

Re: Raspberry pi as a Wake on Lan source

Fri Mar 15, 2013 4:12 pm

Dumb question time...

It's connected. Raspbian is installed. It's running.

I see two terminals, LXTerminal and Root Terminal.

On Ubuntu, I just typed in wakeonlan on the terminal and it asked if I wanted to install wakeonlan.

No luck here. :roll: How do I get wakeonlan either installed or working if it is installed? I was just going to send a test wake on lan command. And then mess with settings up something on cron.

User avatar
rpdom
Posts: 14768
Joined: Sun May 06, 2012 5:17 am
Location: Chelmsford, Essex, UK

Re: Raspberry pi as a Wake on Lan source

Fri Mar 15, 2013 5:09 pm

On the Pi:

sudo apt-get update (just to make sure the software index is up to date)
sudo apt-get install wakeonlan

rasprm3
Posts: 195
Joined: Sun Jan 20, 2013 1:27 am

Re: Raspberry pi as a Wake on Lan source

Fri Mar 15, 2013 6:32 pm

It really helps when the other end of the Ethernet cable is plugged in too. :? Rat's nest of Ethernet cables and the wrong one was plugged in. Someone helped discover that one. Duh...

I've got it updated and upgraded. Wake on lan is installed.

I expanded the partition (?) size when I first started it. And I redid the password so it's not the default anymore.

I need to test out wake on lan and then figure out cron jobs better.

And I know how to shut it down. sudo halt. I wish there was a little on switch though so it doesn't start up as soon as it's plugged in.

rasprm3
Posts: 195
Joined: Sun Jan 20, 2013 1:27 am

Re: Raspberry pi as a Wake on Lan source

Fri Mar 15, 2013 6:42 pm

Dang....

wakeonlan macaddress

That's tells me the mac address I put in isn't a hardware address.

It's wakeonlan ver 0.41.

Maybe there's a different one I can use?

I want it to send a wake on lan magic packet to a Mac address. Hmm....

User avatar
rpdom
Posts: 14768
Joined: Sun May 06, 2012 5:17 am
Location: Chelmsford, Essex, UK

Re: Raspberry pi as a Wake on Lan source

Fri Mar 15, 2013 7:45 pm

Did you use the command in the format:

wakeonlan aa:bb:cc:dd:ee:ff:gg

Where aa:bb:cc:dd:ee:ff:gg is the MAC/hardware address of the machine to wake?

I just did

Code: Select all

pi@raspi1:~$ wakeonlan 00:50:8d:51:40:41
Sending magic packet to 255.255.255.255:9 with 00:50:8d:51:40:41

rasprm3
Posts: 195
Joined: Sun Jan 20, 2013 1:27 am

Re: Raspberry pi as a Wake on Lan source

Fri Mar 15, 2013 9:34 pm

Freaking colons....

Oops. I just had wakeonlan 123456789 No colons in the Mac address. Duh on me. First time Linux user here....

Pi said it sent the magic packet. That test computer is waking up now. Works like it's supposed to. User ignorance.

Now it's just figuring out how to set a cron job. Later I'd like to set up Putty. I think. I was wondering if there would be any security concerns with it. If Putty opens anything up and I'm leaving the Pi on all the time connected to a router. (although that would be someone going through the router to the Pi and I've changed the Pi password now.) I can see needing to change the cronjob times when my schedule changes periodically.


Thanks for the wake solution there. Haha.

rasprm3
Posts: 195
Joined: Sun Jan 20, 2013 1:27 am

Re: Raspberry pi as a Wake on Lan source

Sat Mar 16, 2013 6:07 pm

All right. I'll cave. I've waited couple months and want to wrap this up.

I just need the cron part. I've got the format down now for wake on lan. And I can get in the terminal now. Haha.

I want a cron job for 6:00am weekdays, 5:00pm weekdays, and... say 10:00pm on weekdays/9:00pm on weekends. 10am Sat and Sun too.
And I'll need to be able to change that later.

How do I create a cron job?
How do I list the cron jobs?
How do I delete cron jobs? That sounds easiest. Deleted and recreate, considering it's just one line.

After the cron jobs are set up I can set up the Pi and forget about it.

User avatar
rpdom
Posts: 14768
Joined: Sun May 06, 2012 5:17 am
Location: Chelmsford, Essex, UK

Re: Raspberry pi as a Wake on Lan source

Sat Mar 16, 2013 6:42 pm

rasprm3 wrote:All right. I'll cave. I've waited couple months and want to wrap this up.

I just need the cron part. I've got the format down now for wake on lan. And I can get in the terminal now. Haha.

I want a cron job for 6:00am weekdays, 5:00pm weekdays, and... say 10:00pm on weekdays/9:00pm on weekends. 10am Sat and Sun too.
Add the following to the crontab for the user the jobs need to run as:

Code: Select all

# 6am weekdays
0 6  * * mon-fri path-to-job1

# 5pm weekdays
0 17 * * mon-fri path-to-job2

# 10pm weekdays and 9pm weekends - needs two entries
0 22 * * mon-fri path-to-job3
0 21 * * sat,sun path-to-job3

# 10am Saturday and Sunday
0 10 * * sat,sun path-to-job4
And I'll need to be able to change that later.

How do I create a cron job?
crontab -e
Then add a line as above
How do I list the cron jobs?
crontab -l
How do I delete cron jobs? That sounds easiest. Deleted and recreate, considering it's just one line.
crontab -e
and delete the line
After the cron jobs are set up I can set up the Pi and forget about it.
Yes :)

rasprm3
Posts: 195
Joined: Sun Jan 20, 2013 1:27 am

Re: Raspberry pi as a Wake on Lan source

Sat Mar 16, 2013 8:40 pm

Danke.

Instead of path to job, that would be the wakeonlan ab:cd:ef:gh instead if I want it in the line and not a file?

Do I need a VI or VIM editor or is it all through the terminal command line? I was thinking it was using the terminal and typing in a line for each cron change. This one I'm not quite following...
crontab -e
and delete the line
It sounds like I can list them all and then go up and delete one.

Thanks for the help. I'll figure this out soon. It's not rocket science. I just haven't worked with it yet.

User avatar
rpdom
Posts: 14768
Joined: Sun May 06, 2012 5:17 am
Location: Chelmsford, Essex, UK

Re: Raspberry pi as a Wake on Lan source

Sun Mar 17, 2013 5:14 am

rasprm3 wrote:Instead of path to job, that would be the wakeonlan ab:cd:ef:gh instead if I want it in the line and not a file?
Yes, but to be safe you should use the full path as cron doesn't load all the defaults that you get in the terminal, so that would be /usr/bin/wakeonlan ab:cd:ef:gh.
Do I need a VI or VIM editor or is it all through the terminal command line?
crontab -e will launch whichever is the default editor (vim or nano) with a copy of the current crontab. You can change that by setting the EDITOR= variable in the shell.

There is a way to write the crontab to a file, which you can then edit however you like, and then use it to update the crontab. That is:

Code: Select all

crontab -l >mycronfile
# then edit mycronfile very carefully. Do not delete the comments at the top.
crontab <mycronfile
You can use "man crontab" to find out what the crontab command can do, and "man 5 crontab" to find out about the crontab file format.

rasprm3
Posts: 195
Joined: Sun Jan 20, 2013 1:27 am

Re: Raspberry pi as a Wake on Lan source

Sun Mar 17, 2013 10:04 pm

http://www.tuxradar.com/content/text-ed ... -made-easy
GNU nano, if I need it for later.

Nano is the editor.

wakeonlan worked with the actual computer. I'm setting up cron now. I think I've got it. Just need a test....

Return to “Other projects”