dw-0 / kiauh

Klipper Installation And Update Helper
GNU General Public License v3.0
3.4k stars 492 forks source link

autocommit unable to open script #219

Closed JelleDijkhuizen closed 2 years ago

JelleDijkhuizen commented 2 years ago

Linux Distribution

MainsailOS

What happened

I tried to use the autocommit script. When I executed the script via ssh there are no problems but when i use the macro it tells me sh: 0: Can't open /home/pi/backup.sh

What did you expect to happen

the macro running without a problem

How to reproduce

create a backup macro with the script in /home/pi/backup.sh

Additional information

No response

dw-0 commented 2 years ago

Im unable to give any advice without even knowing the exact content of the macro. Maybe you are experiencing some kind of permission issue here.

JelleDijkhuizen commented 2 years ago

ooo sorry the macro is:

[gcode_shell_command backup_cfg] command: sh /home/pi/backup.sh timeout: 30. verbose: True

[gcode_macro BACKUP_CFG] gcode: RUN_SHELL_COMMAND CMD=backup_cfg

this is the file: -rwxrwxrwx 1 pi pi 1962 Jul 5 21:14 backup.sh

dw-0 commented 2 years ago

Hmmm okay, so its pretty much exactly like written in the wiki article here in this repo. One thing i notice though... is there really no indentation in front of RUN_SHELL_COMMAND ? Afaik indentation is always required after gcode:. So each line has to start at least with a single whitespace.

[gcode_macro BACKUP_CFG]
gcode:
 RUN_SHELL_COMMAND CMD=backup_cfg

Personally i prefer 2-4 whitespaces (usually 4)

[gcode_macro BACKUP_CFG]
gcode:
    RUN_SHELL_COMMAND CMD=backup_cfg
JelleDijkhuizen commented 2 years ago

Yeah there are 4 whitespaces i front of the RUN_SHELL

[gcode_shell_command backup_cfg]
command: sh /home/pi/backup.sh
timeout: 30.
verbose: True

[gcode_macro BACKUP_CFG]
gcode:
    RUN_SHELL_COMMAND CMD=backup_cfg
dw-0 commented 2 years ago

Interesting. I have no other idea right now. Other than maybe trying to move the backup.sh file into your klipper_config folder and try to call that script from there. But i don't really see why it should make a difference. I'll have to try and reproduce that first... i never experienced an issue with that, but then again, i keep that script inside of my klipper_config folder, hence why i came up with that idea right now.