Calling External Commands is not working from gcode

Hello all,

I want to use the "Calling External Commands" function from a gcode file.

I made a configuation file as stated in the manual under "Advanced Themes".
(in my case /var/lib/Repetier-Server/database/extcommands.xml)

The defined command(s) appear in the top right menu and can be executed without any problem.
So there should be no problem with user rights or wrong syntax in the xml config file.

When i try to execute a command from a gcode file with the @execute command, i see an "ok" acknowledge in the log file. But the command is not really executed. (the command generates a txt file)

I'm using Repetier Server 0.51.1 on a Raspberry Pi 2 running Raspbian.

Comments

  • You can not execute the commands you see in the menu. These are commands defined in <command> tag. The one for @execute are like this in the same file and do not appear in the menu.

    &lt;execute name="play" allowParams="true"&gt;/usr/bin/afplay&lt;/execute&gt;
  • Thank you for clarify the difference.
    I didn't read exactly enough to notice the difference between the command and execute tag.
    When I use the execute tag, everything is working as excpected! :-)
  • Hi, could help me about same problem?

    Inside my /var/lib/Repetier-Server/database/extcommands.xml file I created a two new commands: "Switch light" and "Switch FAN" that work perfectly. (all step are done)
    Now I need to switch fan at beginning of print (before extruder on!) but the command @execute Switch FAN (write in event dependent tab) doesn't work.
    If I understood, the cause is that "Switch FAN" is a command that I see in menu. (it call a GPIO24.sh batch)

    So, to try to solve this issue, I added in extcommands.xml file, after commands end tag, this string:

            <execute name="FAN" allowParams="true">/home/pi/Desktop/FAN.sh</execute>

    where FAN.sh is a copy of "GPIO24.sh" called from "Switch FAN" (with same procedure for permission and so on..)

    but it still does't work..

    two questions:

    1) My syntax isn't correct? there is some error?
    2) to verify command, instead of start print, is possible write "@execute FAN" inside gcode console?

    Thank you in advance

    Vittorio
  • SOLVED:

    <execute name="FAN" allowParams="true"> sudo /home/pi/Desktop/FAN.sh</execute>

    lost sudo command..

  • edited May 27
    Hi, i've also problems with executing commands from the dashboard.

    I edit the extcommands.xml with the following commmand. The button shows up but nothing happens when i push it.

    <execute>sudo cat /var/lib/Repetier-Server/database/file.py | ssh root@xxx.xxx.xxx.xxx python</execute>

    I tried also a simple Bash script which does also not work.

    <execute>sudo bash /var/lib/Repetier-Server/database/shutdown.sh</execute>
    <execute>sudo /var/lib/Repetier-Server/database/shutdown.sh</execute>
    <execute>/var/lib/Repetier-Server/database/shutdown.sh</execute>

    I set the rights for the files to 775 but nothing changed. When i execute the commands from CLI everythings works perfect. Can anyone help me to get this solved?

    Thanks in advance!
    dev_printer

  • sudo is most likely your problem. User is repetierserver so you need to add your scripts into the list of sudoers without password prompt. See in our manual how we describe this for the shutdown which we add also to sudoers.
Sign In or Register to comment.