We have moved at community.getvera.com

Author Topic: luup.inet.wget "http://openluup.home.lan/cgi-bin/cmh/backup.sh" not working  (Read 477 times)

Offline RHCPNG

  • Full Member
  • ***
  • Posts: 191
  • Karma: +6/-0
Hi guys,

I have a problem with my scene that runs a backup. It contains only the following luup code:

luup.inet.wget "http://openluup.home.lan/cgi-bin/cmh/backup.sh"

This is what I see in the log of openluup:

2018-08-01 11:08:39.221   openLuup.server:: POST /data_request?id=lr_ALTUI_LuaRunHandler HTTP/1.1 tcp{client}: 0x215ba08
2018-08-01 11:08:39.221   luup_log:0: ALTUI: runLua(luup.inet.wget "http://openluup.home.lan/cgi-bin/cmh/backup.sh")
2018-08-01 11:08:39.223   openLuup.server:: WGET status: closed, request: http://openluup.home.lan/cgi-bin/cmh/backup.sh
2018-08-01 11:08:39.223   luup_log:0: ALTUI: Evaluation of lua code returned: nil
2018-08-01 11:08:39.224   openLuup.server:: request completed (8 bytes, 1 chunks, 2 ms) tcp{client}: 0x215ba08
2018-08-01 11:08:39.224   openLuup.server:: socket closed: closed tcp{client}: 0x215ba08
2018-08-01 11:08:40.229   openLuup.server:: closing client connection: tcp{client}: 0x1955098

Nothing more.

When I just put the URL in my browser it works fine. Also doing a wget via command line in openluup works fine.

I don't get it. Can you help me out?

Thanks.

ps. I'm on openluup version 18.3.23

*Update*

Running it from Vera doesn't work either, so maybe it's a network issue. I see this in the log Vera:

08   08/01/18 11:28:11.734   JobHandler_LuaUPnP::HandleActionRequest argument action=RunLua <0x72584520>
08   08/01/18 11:28:11.734   JobHandler_LuaUPnP::HandleActionRequest argument Code=luup.inet.wget "http://openluup.home.lan/cgi-bin/cmh/backup.sh" <0x72584520>
01   08/01/18 11:28:11.738   FileUtils::ReadURL 6/resp:0 user: pass: size 1 http://openluup.home.lan/cgi-bin/cmh/backup.sh response:  <0x72584520>
06   08/01/18 11:28:13.670   Device_Variable::m_szValue_set device: 30 service: urn:micasaverde-com:serviceId:EnergyMetering1 variable: KWH_frac was: 4901.665 now: 4901.671 #hooks: 0 upnp: 0 skip: 0 v:(nil)/NONE duplicate:0 <0x72784520>

I also tried the URL with the IP address in it, didn't work either.
« Last Edit: August 01, 2018, 05:33:19 am by RHCPNG »

Offline akbooer

  • Moderator
  • Master Member
  • *****
  • Posts: 6387
  • Karma: +292/-70
  • "Less is more"
Try using port 3480?

Code: [Select]
luup.inet.wget "http://openluup.home.lan:3480/cgi-bin/cmh/backup.sh"
3x Vera Lite-UI5/Edge-UI7, 25x Fibaro, 23x TKB, 9x MiniMote, 2x NorthQ Power, 2x Netatmo, 1x Foscam FI9831P, 9x Philips Hue,
Razberry, MySensors Arduino, HomeWave, AltUI, AltHue, DataYours, Grafana, openLuup, ZWay, ZeroBrane Studio.

Offline RHCPNG

  • Full Member
  • ***
  • Posts: 191
  • Karma: +6/-0
Try using port 3480?

Code: [Select]
luup.inet.wget "http://openluup.home.lan:3480/cgi-bin/cmh/backup.sh"

That seems to work. Although I get a timeout in the test lua. Is that expected in this case?

Any idea why it doesn't work without the port?

Offline akbooer

  • Moderator
  • Master Member
  • *****
  • Posts: 6387
  • Karma: +292/-70
  • "Less is more"
That seems to work.

Good!

Quote
Although I get a timeout in the test lua. Is that expected in this case?

Possible, since the compression of the backup file might take a little while.  But I'm surprised.  Is this true for both openLuup and Vera, or just one of them?

Quote
Any idea why it doesn't work without the port?

Why would it?   Vera and openLuup use port 3480 for their server requests.  Sending it somewhere else and whatever is listening won't understand it.  Vera has recently (or are about to) switched off direct access to that port, so, in fact, you should go through port 80 using

Code: [Select]
luup.inet.wget "http://openluup.home.lan/port_3480/cgi-bin/cmh/backup.sh"

which the lighttp server redirects.  For openLuup, you must use the actual port, since it runs its own HTTP server, which is nothing to do with the Apache one, or whatever your system is normally using.
3x Vera Lite-UI5/Edge-UI7, 25x Fibaro, 23x TKB, 9x MiniMote, 2x NorthQ Power, 2x Netatmo, 1x Foscam FI9831P, 9x Philips Hue,
Razberry, MySensors Arduino, HomeWave, AltUI, AltHue, DataYours, Grafana, openLuup, ZWay, ZeroBrane Studio.

Offline RHCPNG

  • Full Member
  • ***
  • Posts: 191
  • Karma: +6/-0
Ok, thanks AK!

I think it used to work, but that's probably because of changes in my nginx setup.