You are not logged in.

#1 2008-04-13 00:20:08

thejinx0r
Member
Registered: 2008-02-18
Posts: 7

[Help] Wake / Sleep on Lan Script

Hey Guys,

Main part starts after  the bottom bold part

I need help with writing a couple of scripts.
One to wake on lan and one to make it sleep.

So here's what I'm going to do:

I have a laptop and an old computer. My computer is the one that needs to be turned on and off. I want my laptop to trigger it on when it turns on and I want my computer to turn off after 100 failed pings to my computer.
I use netcfg2 on my laptop. So, when my laptop is on, AND is connected to my "home" network, it turns on  the computer.

So for this part, I was thinking of a script + cron daemon since I couldn't find a way to parse commands as netcfg2 connects.

To turn off my computer, same as above, script + cron daemon.
But my computer runs ubuntu though.

Now, if anyone has any way to parse commands after netcfg2 connects successfully, please let me know.

Need Help Here
So, what I need is to learn how write a bash script that can read the command line output.
Read as in being able to detect the outputs of a command.
So, if I did something like "netcfg2 -c home"and the output is "home already connected", then it should issue the command to wake up my computer.

But I have no clue on how to do that.

Any help to point me in the right direction would be very appreciated big_smile

TJ



P.S. Unless you guys want to write the script for me smile
Would make my life even easier.

P.S. #2, is there a way to make a script to login in ssh, then run a command in that ssh environment?

Last edited by thejinx0r (2008-04-13 00:22:26)

Offline

#2 2008-04-13 13:05:34

thejinx0r
Member
Registered: 2008-02-18
Posts: 7

Re: [Help] Wake / Sleep on Lan Script

So, Ive inadvertently discovered a way to make it auto-on in much simpler way.
I made a mount point from my computer to my laptop and so now when ever my computer tries to mount it, it turns on the computer.

Now,
For the turning off part, I think I'm going to go with computer activity?

Offline

Board footer

Powered by FluxBB