Failure running commands via extcommands.xml

Raspberry Pi 3
Repetier Server 0.80.0 (no modifications)

I've scoured documentation and can't seem to figure out how to run commands via extcommands.xml. As a simple test, I created a bash script that simply echoes a text string to a file in the /var/lib/Repetier-Server/database directory, but when trying to execute from the Repetier Server webpage, nothing happens. The script DOES execute correctly via the CLI. 

I've set the test.sh script to executable and changed ownership to repetierserver.dialout and made the script executable.

I've added the following to extcommands.xml (and restarted):

<command>

<name>Test</name>

<execute>/var/lib/Repetier-Server/database/test.sh</execute>

</command>

To be thorough, I also replaced the above with this:

<command>

<name>Test</name>

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

</command>


No difference.

What am I missing?

Comments

  • See  /var/lib/Repetier-Server/logs/server.log for more information if it gets executed. At least the version without sudo should work. For sudo it must be in the list of sudoers without password request.

    What exactly is the test.sh content? You execute it from shell with a different working directory then when server starts it so it might be an error in the script that tries to write somewhere else.
  • pi@hostname:~ $ tail -f /var/lib/Repetier-Server/logs/server.log.0
    Starting external command /var/lib/Repetier-Server/database/test.sh with 0 parameters.

    Contents of test.sh:

    #!/bin/bash
    echo "randomtext" > /var/lib/Repetier-Server/database/file.txt

    Contents of extcommands.xml:

    <name>Test</name>
    <execute>/var/lib/Repetier-Server/database/test.sh</execute>
    </command>


    The file test.sh is executable by all, and file.txt is writable by all. 

    if I execute test.sh using sudo -u repetierserver, it succeeds.

    I have added repetierserver to the sudoers file with ALL permissions (merely as a test) and the only way I can get it to succeed is by issuing the command via the terminal. 


  • Disregard - I got it working. I started with a fresh extcommands.xml (from backup) and was able to add what I needed. Evidently there was something in my extcommands.xml that botched the execution. 

    Thanks for the help!
Sign In or Register to comment.