How to use extcommands?

edited October 2019 in Questions & Answers

My /var/lib/Repetier-Server/database/extcommands.xml looks exactly like this:

<config>
  <command>
    <name>extcmd test</name>
    <execute>date | tee /tmp/test.txt</execute>
    <confirm>Execute Test?</confirm>
    <!-- Define if command should show up in local printer interface, default true.-->
    <local>true</local>
    <!-- Define if command should show up in remote printer interface, default true.-->
    <remote>true</remote>
    <!-- Define if command should show up only for users with print permission, default true.-->
    <print-permission>false</print-permission>
    <!-- Define if command should show up only for users with add files permission, default false.-->
    <add-permission>false</add-permission>
    <!-- Define if command should show up only for users with del files permission, default false.-->
    <del-permission>false</del-permission>
    <!-- Define if command should show up only for users with configuration permission, default false.-->
    <config-permission>true</config-permission>
  </command>
</config>

The (demonstration) purpose is to write the output of the command date (current date and time of command execution) into the local file /tmp/test.txt.

I have restarted RepetierServer and found the new menu entry extcmd test as expected. When I activate that menu item and accept the confirmation dialog, nothing is written to the disk. I see no /tmp/test.txt while the /tmp folder is writable to everyone (perms: 077/rwx,rwx,rwx).

How to perform the desired action?

I am using Petetier-Server Pro 0.92.3.

PS: The later goal is to write a random token to disk, and trigger an external web service afterwards. I need to write something to the local disk and place a web call (e.g. using wget).

Comments

  • You are executing a command not a script. Operations like | doable in bash are not allowed here. Write a script accessible from user repetierserver and enter the full path in execute instead.

    #!/bin/bash
    date | tee /tmp/test.txt

    With permission rx for everyone in /var/lib/Repetier-Server/scripts/
Sign In or Register to comment.