Output shell script #381

Open
opened 2020-12-28 21:39:12 +00:00 by Boergi · 8 comments
Boergi commented 2020-12-28 21:39:12 +00:00 (Migrated from github.com)

Describe the bug
Hi, if I create an output "shell script" with the path to the script and execute it, the whole webinterface does not react anymore and I have to restart the PI.

To Reproduce
Steps to reproduce the behavior:

  1. Create a output "shell script" with the path of it
  2. Click on the execute bottom of the output
  3. See error

Additional context
Bildschirmfoto 2020-12-28 um 22 38 47

**Describe the bug** Hi, if I create an output "shell script" with the path to the script and execute it, the whole webinterface does not react anymore and I have to restart the PI. **To Reproduce** Steps to reproduce the behavior: 1. Create a output "shell script" with the path of it 2. Click on the execute bottom of the output 3. See error **Additional context** <img width="546" alt="Bildschirmfoto 2020-12-28 um 22 38 47" src="https://user-images.githubusercontent.com/23065187/103244490-7e056100-495d-11eb-951c-36e6fd64e067.png">
SaKiEQ commented 2021-01-05 19:29:05 +00:00 (Migrated from github.com)

I am doing pretty much the same, except with python scripts and not having any issues...

Does you shell script execute when called directly from a terminal ? It also depends what your script contains...
B1868D46-72F4-4DEF-8539-EA718EFE395C

I am doing pretty much the same, except with python scripts and not having any issues... Does you shell script execute when called directly from a terminal ? It also depends what your script contains... ![B1868D46-72F4-4DEF-8539-EA718EFE395C](https://user-images.githubusercontent.com/35499064/103690192-648b9700-4fa5-11eb-83f5-f609a0dfbe29.jpeg)
Boergi commented 2021-01-05 20:43:13 +00:00 (Migrated from github.com)

I have test it to with a python script, but the same problem. Octoprint hangs completely and you have to restart the Pi.

Over the terminal i can execute the script with no errors.

This is the script:

import requests
url = 'XY'
headers = {
    'Accept': 'application/json, text/javascript, */*; q=0.01',
    'X-Requested-With': 'XMLHttpRequest',
    'Content-Type': 'application/json; charset=UTF-8'
}
payload = ''
r = requests.post(url, data=payload, headers=headers)
print r
I have test it to with a python script, but the same problem. Octoprint hangs completely and you have to restart the Pi. Over the terminal i can execute the script with no errors. This is the script: ``` import requests url = 'XY' headers = { 'Accept': 'application/json, text/javascript, */*; q=0.01', 'X-Requested-With': 'XMLHttpRequest', 'Content-Type': 'application/json; charset=UTF-8' } payload = '' r = requests.post(url, data=payload, headers=headers) print r ```
luizbgomide commented 2022-02-28 14:36:54 +00:00 (Migrated from github.com)

I was having this issue with octoprint hanging. Now I recreated everything and it doesn't hang, but also doesn't work... :/

I create a script with a just an echo 'test' and it doesn't output anything....

image

I was having this issue with octoprint hanging. Now I recreated everything and it doesn't hang, but also doesn't work... :/ I create a script with a just an `echo 'test'` and it doesn't output anything.... ![image](https://user-images.githubusercontent.com/18707781/156001494-bc33d3d3-672a-45de-9cb1-a8f4f95807f1.png)
vitormhenrique commented 2022-02-28 17:34:09 +00:00 (Migrated from github.com)

@luizbgomide Shell script is only supposed to run the script, not to output anything that it spits out.
https://github.com/vitormhenrique/OctoPrint-Enclosure/blob/master/octoprint_enclosure/init.py#L534

@[luizbgomide](https://github.com/luizbgomide) Shell script is only supposed to run the script, not to output anything that it spits out. https://github.com/vitormhenrique/OctoPrint-Enclosure/blob/master/octoprint_enclosure/__init__.py#L534
vitormhenrique commented 2022-02-28 17:35:46 +00:00 (Migrated from github.com)

@BoergiM87 that is a PYTHON script, and this is not supposed to run a PYTHON script, only a SHELL script. Unless you call it with a python before it will never work.

@BoergiM87 that is a PYTHON script, and this is not supposed to run a PYTHON script, only a SHELL script. Unless you call it with a python before it will never work.
luizbgomide commented 2022-02-28 20:43:50 +00:00 (Migrated from github.com)

@vitormhenrique my issue was that it doesn't seem like the script was actually running.
In the end I removed all my settings and recreated the call to the scripts and it worked... I'm really not sure of why it didn't work before.

I'm using that to trigger PSU Control, only because it has a dedicated icon on Printoid, otherwise it could have managed it entirely in your plugin...

@vitormhenrique my issue was that it doesn't seem like the script was actually running. In the end I removed all my settings and recreated the call to the scripts and it worked... I'm really not sure of why it didn't work before. I'm using that to trigger PSU Control, only because it has a dedicated icon on Printoid, otherwise it could have managed it entirely in your plugin...
DiP-ER commented 2023-01-18 15:02:34 +00:00 (Migrated from github.com)

@vitormhenrique my issue was that it doesn't seem like the script was actually running. In the end I removed all my settings and recreated the call to the scripts and it worked... I'm really not sure of why it didn't work before.

I'm using that to trigger PSU Control, only because it has a dedicated icon on Printoid, otherwise it could have managed it entirely in your plugin...

@luizbgomide Did you ever figure out what the problem was besides removing your settings and re-creating them? I'm having the same issue trying to call:

curl -s -H "Content-Type: application/json" -H "X-Api-Key: YOUR_API_KEY" -X POST -d '{ "command":"turnPSUOn" }' http://YOUR_OCTOPRINT_SERVER/api/plugin/psucontrol

I created a script to touch a file which works, but doesn't like the above line.

> @vitormhenrique my issue was that it doesn't seem like the script was actually running. In the end I removed all my settings and recreated the call to the scripts and it worked... I'm really not sure of why it didn't work before. > > I'm using that to trigger PSU Control, only because it has a dedicated icon on Printoid, otherwise it could have managed it entirely in your plugin... @luizbgomide Did you ever figure out what the problem was besides removing your settings and re-creating them? I'm having the same issue trying to call: curl -s -H "Content-Type: application/json" -H "X-Api-Key: YOUR_API_KEY" -X POST -d '{ "command":"turnPSUOn" }' http://YOUR_OCTOPRINT_SERVER/api/plugin/psucontrol I created a script to touch a file which works, but doesn't like the above line.
luizbgomide commented 2023-01-18 15:12:27 +00:00 (Migrated from github.com)

@DiP-ER no, no idea.

@DiP-ER no, no idea.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: Gandalf/OctoPrint-Enclosure#381