Koozali.org: home of the SME Server
Obsolete Releases => SME Server 9.x => Topic started by: LANMonkey on December 01, 2013, 09:06:51 PM
-
I'd like to use SME to apply Wake on LAN to computers on my LAN. Is there a contrib available, or should I use an RPM? What's the best source?
Any and all tips or clues would be appreciated.
-
See http://wiki.contribs.org/SME_Server:Documentation:Administration_Manual:Chapter10#Use_WOL_to_power_on_Workstation for setting up via Server-Manager
or
use a cron job for a specific PC
/sbin/ether-wake E8:39:35:EE:28:96
or
/usr/bin/wol 18:A9:05:BC:AC:76
-
I just use web page with preset MAC addresses.
I will post some code later
-
php code to wakeup a sleeping computer
name your file similar to this wakeupcomputername.php
<?php
flush();
function WakeOnLan($addr, $mac)
{
$addr_byte = explode(':', $mac);
$hw_addr = '';
for ($a=0; $a < 6; $a++) $hw_addr .= chr(hexdec($addr_byte[$a]));
$msg = chr(255).chr(255).chr(255).chr(255).chr(255).chr(255);
for ($a = 1; $a <= 16; $a++) $msg .= $hw_addr;
// send it to the broadcast address using UDP
// SQL_BROADCAST option isn't help!!
$s = socket_create(AF_INET, SOCK_DGRAM, SOL_UDP);
if ($s == false)
{
echo "Error creating socket!<br>\n";
echo "Error code is '".socket_last_error($s)."' - " . socket_strerror(socket_last_error($s)) . "<br>\n";
}
else
{
// setting a broadcast option to socket:
$opt_ret = socket_set_option($s, 1, 6, TRUE);
if($opt_ret < 0)
{
echo "setsockopt() failed, error: " . strerror($opt_ret) . "<br>\n";
}
$e = socket_sendto($s, $msg, strlen($msg), 0, $addr, 2050);
socket_close($s);
echo "A wake up command was sent to computer with the mac address.<br>\n";
echo "Magic Packet sent (".$e.") to ".$addr.", MAC=".$mac."<br>\n";
echo "Wait some seconds before trying to access the computer.<br>\n";
}
}
#WakeOnLan('yourIPorDomain.dyndns.org', 'your:MAC:address');
#WakeOnLan('192.168.1.255', '00:01:1C:10:04:03');
//if you have switch or other routing devices in LAN, sending to
// the local IP doesn't help! you need send to the broadcast address like this:
WakeOnLan('192.168.1.255', '00:18:4d:f0:09:f9');
//system("ping 192.168.1.51",$return);
?>
-
TerryF, I tried /usr/bin/wol and got "file not found". The addition to backup looks interesting, but I don't use SME as a target for backups. I do have the program /sbin/ether-wake, but I am having no luck trying to start up my little Acer Aspire One 756-2887 laptop from SME server. Maybe I should say that I am trying to wake up other systems from my SME, not trying to wake up SME itself.
The laptop was on another subnet and so I tried hooking it up to the same subnet with SME and still nothing. I have tried waking it up from hibernation, sleep and soft shutdown, hibernation from Windows 7 and sleep using the hardware control from the Fn keys. The WOL has been enabled in the BIOS.
What could be standing in the way? I've double checked the MAC address from "ipconfig /all" in the Windows command line accessory.
purvis, thanks for the code, that really explains how it all works.
-
TerryF, I tried /usr/bin/wol and got "file not found".
Its a utility you have to install, just a simple tool.
I do have the program /sbin/ether-wake, but I am having no luck trying to start up my little Acer Aspire One 756-2887 laptop from SME server. Maybe I should say that I am trying to wake up other systems from my SME, not trying to wake up SME itself.
The laptop was on another subnet and so I tried hooking it up to the same subnet with SME and still nothing. I have tried waking it up from hibernation, sleep and soft shutdown, hibernation from Windows 7 and sleep using the hardware control from the Fn keys. The WOL has been enabled in the BIOS.
Please show us the command line you are using?
Are you attempting wol using the laptops wireless card?
You may need to forward port 9 or 7, this also becomes problamatic as to whether you can forward to a mac address or internal IP.
I know SME server will wake up a PC using wol, so you just have to investigate the whys of your setup.
Worth a read just for background http://en.wikipedia.org/wiki/Wake-on-LAN
-
Are you using SME9 beta?
I have found that you need to specify the -i option for wol to work on SME9b3
There appears to have been a change in the ether-wake utility.
The -i option was not necessary in SME8
-
Are you using SME9 beta?
I have found that you need to specify the -i option for wol to work on SME9b3
There appears to have been a change in the ether-wake utility.
The -i option was not necessary in SME8
I'm running SME8, but I'll try it again anyway tomorrow when I get a LAN port available.
-
I'm running SME8, ...
Then you are posting in the wrong forum :-)
-
Oops! You are right. I was convinced I was running 9. I do have a dormant test server running 9, I'm still trying to figure out some way of upgrading MySQL on SME.
Anyway, I have tested WOL on another desktop (Optiplex SX260) using /sbin/ether-wake and it works fine. I don't know yet why it is not working on my little Acer Aspire One. But I'm on my way and I consider the Problem Solved.
Thanks to all who replied.
-
LANMonkey
I have tested WOL on another desktop (Optiplex SX260) using /sbin/ether-wake and it works fine. I don't know yet why it is not working on my little Acer Aspire One.
This link (posted earlier)
http://wiki.contribs.org/SME_Server:Documentation:Administration_Manual:Chapter10#Use_WOL_to_power_on_Workstation for setting up via Server-Manager
gives clues re system requirements which need to be met, you could check those are satisfied, as a starting point to resolution.
I'm still trying to figure out some way of upgrading MySQL on SME.
Follow generic instructions at mysql website, but I would definitely do this on a test server first.
There were some very old howtos (I think for sme 4 or thereabouts) that would give you the general idea. Search !
Having upgraded mysql, you may then run into issues when you do sme server regular upgrades (which cannot be predicted at this time), so be aware that you may introduce "future" problems.
I did a quick search for you
http://distro.ibiblio.org/smeserver/contribs/rmitchell/smeserver/howto/MYSQL%20update%20to%20v4%20HOWTO%20for%20sme%20server.htm
It's old but the procedure should be similar, so update the steps & apply them accordingly to currently available rpms.
-
Thanks janet, TerryF already posted the WOL link you posted above.
I'll keep your MySQL tip in mind. I have tried an upgrade before and it was a major disaster. I have a testing server, but giving it another try is not something I am looking forward to at this point, especially if it is experimental. Search my user name and "MySQL" to find when I sought help with this issue, if you are interested in the subject.