First of all you can check if the WOL function is working correcly in
the machine you're trying to wake up by using the 'wakeonlan' command
from your Guacamole machine.
eg. wakeonlan 2D:4A:54:58:FB:FA (obviously changing the MAC to the
correct one for your target machine). Etherwake would also do the same job.
If wakeonlan isn't installed just apt-get install wakeonlan (assuming a
debian-based distro).
If that doesn't work you'll need to sort out the target machine.
Otherwise if it does work then there could be a problem with the format
of the macs.list file, or the id number/MAC in the macs.list file isn't
correct for that connection.
To check this out - tail catalina.out when you attempt a connect to the
machine and ensure the connection number is the same as that in the
macs.list file (with associated MAC for that machine).
The WOL part of the code is fairly standard, but if all else fails you
could try something like this (save it into a new file, eg wol2.py, and
run it same as the other - you may need to change the location of the
macs.list file, and catalina.out if you're using a different version of
Tomcat):
#!/usr/bin/env python2
import subprocess, csv, sys
logfile =
subprocess.Popen(['tail','-F','/var/log/tomcat8/catalina.out'],stdout=subprocess.PIPE,stderr=subprocess.PIPE)
while True:
line = logfile.stdout.readline()
with open('/home/user/macs.list') as inifile:
reader = csv.DictReader(inifile)
if 'connected to connection' in line:
q1 = line.find("\"")
q2 = line.find("\"",q1+1)
q3 = line.find("\"",q2+1)
q4 = line.find("\"",q3+1)
user = line[q1+1:q2]
conn_num = line[q3+1:q4]
for row in reader:
if(row['id']) == conn_num:
# print (conn_num)
# print(row['mac'])
m=(row['mac'])
# print (m)
subprocess.call (["wakeonlan", (m)])
This is largely the same code but it'd call wakeonlan to wake the
machine up, and pass it the correct MAC. You can remove the comments
from the print statements to check how the code is performing and if
it's got the correct detail (the connection number and MAC address
should appear in your terminal when a connection is attempted).
On 2/04/2020 2:08 a.m., Piviul wrote:
Piviul ha scritto il 01/04/20 alle 14:33:
ivanmarcus ha scritto il 01/04/20 alle 13:01:
[...]
"logfile =
subprocess.Popen(['tail','-F','/var/log/tomcat7/catalina.out'],stdout=subprocess.PIPE,stderr=subprocess.PIPE)"
- all on the one line.
thank you very much Ivan! ...but I get another error:
$ guac_wol.py
Traceback (most recent call last):
File "./guac_wol.py", line 88, in <module>
if(row['id']) == conn_num:
KeyError: 'id'
ooops, it's my fault, the macs.list was not configured properly...
Any way doesn't seems to works... in effect it's the WOL function that
doesn't wake up the PC...
Piviul
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]