Re: guacamole and wake-on-LAN
Well that answers something I was curious about... ... the online Nabble instance doesn't display Unicode 6.0 chrs (well, a thumbs up U+1F44D at least), but it does pass it on in email. Anyway I'm pleased the WOL script's working with the right NIC :-) On 3/04/2020 7:29 p.m., ivanmarcus wrote: On 3/04/2020 7:10 p.m., Piviul wrote:
Re: guacamole and wake-on-LAN
On 3/04/2020 7:10 p.m., Piviul wrote: ivanmarcus ha scritto il 01/04/20 alle 15:37: 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): Thank you very much indeed; in effect I was trying to test your script with a notebook that was connected to the lan using the wireless card and the wireless doesn't seems to support WOL... (^_^;) Any way with network cards WOL capable your script seems to work very well... Thank you very much! Piviul - To unsubscribe, e-mail: user-unsubscr...@guacamole.apache.org For additional commands, e-mail: user-h...@guacamole.apache.org
Re: guacamole and wake-on-LAN
ivanmarcus ha scritto il 01/04/20 alle 15:37: 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): Thank you very much indeed; in effect I was trying to test your script with a notebook that was connected to the lan using the wireless card and the wireless doesn't seems to support WOL... (^_^;) Any way with network cards WOL capable your script seems to work very well... Thank you very much! Piviul - To unsubscribe, e-mail: user-unsubscr...@guacamole.apache.org For additional commands, e-mail: user-h...@guacamole.apache.org
Re: guacamole and wake-on-LAN
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 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: user-unsubscr...@guacamole.apache.org For additional commands, e-mail: user-h...@guacamole.apache.org
Re: guacamole and wake-on-LAN
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 if(row['id']) == conn_num: KeyError: 'id' :( Piviul - To unsubscribe, e-mail: user-unsubscr...@guacamole.apache.org For additional commands, e-mail: user-h...@guacamole.apache.org
Re: guacamole and wake-on-LAN
Piviul, It looks as if the mailing list has introduced a new line where there's not meant to be one. Apologies for not noticing that earlier. The line "logfile =" is meant to read: "logfile = subprocess.Popen(['tail','-F','/var/log/tomcat7/catalina.out'],stdout=subprocess.PIPE,stderr=subprocess.PIPE)" - all on the one line. I suspect in your script you'll just need to bring up the text in line below "logfile =" and tack it on the end for it to work. On 1/04/2020 10:59 p.m., Piviul wrote: ivanmarcus ha scritto il 15/03/20 alle 02:57: I've already written a Python script that reads the log and sends the magic packet as needed. It's been running for a couple of years now, Many thanks Ivan! I would like to use your script but when I run it I get the error: $ ./guac_wol.py File "./guac_wol.py", line 64 logfile = ^ SyntaxError: invalid syntax I don't know python and I can't understand why I get this error in your script... Piviul - To unsubscribe, e-mail: user-unsubscr...@guacamole.apache.org For additional commands, e-mail: user-h...@guacamole.apache.org
Re: guacamole and wake-on-LAN
ivanmarcus ha scritto il 15/03/20 alle 02:57: I've already written a Python script that reads the log and sends the magic packet as needed. It's been running for a couple of years now, Many thanks Ivan! I would like to use your script but when I run it I get the error: $ ./guac_wol.py File "./guac_wol.py", line 64 logfile = ^ SyntaxError: invalid syntax I don't know python and I can't understand why I get this error in your script... Piviul - To unsubscribe, e-mail: user-unsubscr...@guacamole.apache.org For additional commands, e-mail: user-h...@guacamole.apache.org
Re: guacamole and wake-on-LAN
The requirements are Python 2.7 installed on the Guacamole machine. You should be able to run the script from anywhere (I use /home/adminuserx) and start with /home/adminuserx/guac_wol.py &! (guac_wol.py being the script name I use). The macs.list file is in the same directory as the script. I use it with Guacamole 1.1.0, I needed to change the path to catalina.out in the script because I upgraded to tomcat8 from 7, but that was about it. You may need to change the path to the macs.list file as well. To my mind it was an interim step until someone with better coding skills than me produced a 'proper' version that integrated with Guacamole, or it became part of Guacamole itself. It is a little 'clunky' in that you need to ensure the connection number produced in the catalina.out log file is correct for the that machine's mac address as listed in the macs.list file, but that said it's worked well enought for me in the past couple of years (~60 users). To my mind it would be best if it were a form field in the individual connection settings, but that was way beyond my capabilities. However Nick has mentioned a couple of times that he was producing the extension I referenced. I expect this would be a lot better, but I've not used it myself and don't know how finished it is. He may be able to provide an update? On 16/03/2020 11:45 a.m., Giorgio wrote: Hello Ivan, Could you please explain how to implement your script into guacamole ? Does it work with guacamole 1.1.0 ? Place to put, and how to execute upon request.. any detail will be of help. Thank you in advance Tedd *From: * ivanmarcus *To: * , Vieri *Sent: * 3/15/2020 2:57 AM *Subject: * Re: guacamole and wake-on-LAN I've already written a Python script that reads the log and sends the magic packet as needed. It's been running for a couple of years now, here's a link: http://apache-guacamole-general-user-mailing-list.2363388.n4.nabble.com/Wake-on-lan-function-working-td2832.html Nick has been working on a proper extension. I've no idea how far on it is at present but here's a link for it: https://github.com/necouchman/guacamole-client/tree/jira/513/extensions/guacamole-auth-wol On 15/03/2020 2:26 p.m., Vieri wrote: Hi, I'd like to boot machines up if offline through Guacamole. I've seen that other users propose to use a script that reads guacamole's log, gets the connection attempts, looks up the MAC address and performs WOL.?? I guess it might also be done through an extension. Any pointers? Or better yet, any ready-made code? ;-) Thanks, Vieri - To unsubscribe, e-mail:user-unsubscr...@guacamole.apache.org <mailto:user-unsubscr...@guacamole.apache.org> For additional commands, e-mail:user-h...@guacamole.apache.org <mailto:user-h...@guacamole.apache.org>
Re: guacamole and wake-on-LAN
Hello Ivan, Could you please explain how to implement your script into guacamole ? Does it work with guacamole 1.1.0 ? Place to put, and how to execute upon request.. any detail will be of help. Thank you in advance Tedd From: ivanmarcus To: , Vieri Sent: 3/15/2020 2:57 AM Subject: Re: guacamole and wake-on-LAN I've already written a Python script that reads the log and sends the magic packet as needed. It's been running for a couple of years now, here's a link: http://apache-guacamole-general-user-mailing-list.2363388.n4.nabble.com/Wake-on-lan-function-working-td2832.html Nick has been working on a proper extension. I've no idea how far on it is at present but here's a link for it: https://github.com/necouchman/guacamole-client/tree/jira/513/extensions/guacamole-auth-wol On 15/03/2020 2:26 p.m., Vieri wrote: Hi, I'd like to boot machines up if offline through Guacamole. I've seen that other users propose to use a script that reads guacamole's log, gets the connection attempts, looks up the MAC address and performs WOL.?? I guess it might also be done through an extension. Any pointers? Or better yet, any ready-made code? ;-) Thanks, Vieri - To unsubscribe, e-mail: user-unsubscr...@guacamole.apache.org For additional commands, e-mail: user-h...@guacamole.apache.org
Re: guacamole and wake-on-LAN
I've already written a Python script that reads the log and sends the magic packet as needed. It's been running for a couple of years now, here's a link: http://apache-guacamole-general-user-mailing-list.2363388.n4.nabble.com/Wake-on-lan-function-working-td2832.html Nick has been working on a proper extension. I've no idea how far on it is at present but here's a link for it: https://github.com/necouchman/guacamole-client/tree/jira/513/extensions/guacamole-auth-wol On 15/03/2020 2:26 p.m., Vieri wrote: Hi, I'd like to boot machines up if offline through Guacamole. I've seen that other users propose to use a script that reads guacamole's log, gets the connection attempts, looks up the MAC address and performs WOL. I guess it might also be done through an extension. Any pointers? Or better yet, any ready-made code? ;-) Thanks, Vieri - To unsubscribe, e-mail: user-unsubscr...@guacamole.apache.org For additional commands, e-mail: user-h...@guacamole.apache.org