FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > Ubuntu > Ubuntu User

 
 
LinkBack Thread Tools
 
Old 02-19-2009, 09:00 PM
CLIFFORD ILKAY
 
Default How to Turn on a Machine Remotely (was question)

charles olveira wrote:
> hello
> i want to turn on a mashine remotly in the remote mashine have ubuntu
> installed,
> i want to turn on the mashine from a virtual mashine in my local mashine
> in the virtual mashine also i have ubuntu installed,
> sombody can tell me any programs for use in ubuntu

Most modern systems have WOL (Wake On LAN). Here is some Python code
that will do WOL.

# Wake-On-LAN
#
# Copyright (C) 2002 by Micro Systems Marc Balmer
# Written by Marc Balmer, marc@msys.ch, http://www.msys.ch/
# This code is free software under the GPL

import struct, socket

def WakeOnLan(ethernet_address):
'
Example usage: WakeOnLan('0:3:93:81:68:b2')
'

# Construct a six-byte hardware address

addr_byte = ethernet_address.split(':')
hw_addr = struct.pack('BBBBBB', int(addr_byte[0], 16),
int(addr_byte[1], 16),
int(addr_byte[2], 16),
int(addr_byte[3], 16),
int(addr_byte[4], 16),
int(addr_byte[5], 16))

# Build the Wake-On-LAN "Magic Packet"...

msg = 'xff' * 6 + hw_addr * 16

# ...and send it to the broadcast address using UDP

s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
s.setsockopt(socket.SOL_SOCKET, socket.SO_BROADCAST, 1)
s.sendto(msg, ('<broadcast>', 9))
s.close()
# End of code #

This would only work on the same network so if you're not, it's more
complicated. A low-tech way of doing it is to use a hardware device that
can be controlled via TCP/IP or even DTMF (telephone). I have a power
controller device that will listen for certain DTMF tones and either
power on or power off the unit that is attached to it.
--
Regards,

Clifford Ilkay
Dinamis
1419-3266 Yonge St.
Toronto, ON
Canada M4N 3P6

<http://dinamis.com>
+1 416-410-3326
--
ubuntu-users mailing list
ubuntu-users@lists.ubuntu.com
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
 
Old 02-19-2009, 09:16 PM
Norberto Bensa
 
Default How to Turn on a Machine Remotely (was question)

On Thu, Feb 19, 2009 at 8:00 PM, CLIFFORD ILKAY
<clifford_ilkay@dinamis.com> wrote:
> Here is some Python code
> that will do WOL.

$ apt-cache search wake on lan
wakeonlan - Sends 'magic packets' to wake-on-LAN enabled ethernet adapters

:-)

Regards,
Norberto

--
ubuntu-users mailing list
ubuntu-users@lists.ubuntu.com
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
 

Thread Tools




All times are GMT. The time now is 07:07 PM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org