How to Turn on a Machine Remotely (was question)
CLIFFORD ILKAY
clifford_ilkay at dinamis.com
Thu Feb 19 22:00:36 UTC 2009
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 at 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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 3286 bytes
Desc: S/MIME Cryptographic Signature
URL: <https://lists.ubuntu.com/archives/ubuntu-users/attachments/20090219/40896b40/attachment.bin>
More information about the ubuntu-users
mailing list