bash script not works with external commands
Hello everyone.
when I run bash script from external commands nothing happens.
Script to turn on the printer
Thank you for help.
when I run bash script from external commands nothing happens.
Script to turn on the printer
#!/bin/bash
if [ ! -d /sys/class/gpio/gpio17 ]
then
echo "17" > /sys/class/gpio/export
sleep 1;
fi
echo "out" > /sys/class/gpio/gpio17/direction
echo "1" > /sys/class/gpio/gpio17/value
When I run it from console it works.
In extcommands.xml <execute>/var/lib/Repetier-Server/database/turnOnPrinter.sh</execute>I added /bin/bash to sudoers.d
# echo "repetierserver ALL=NOPASSWD: /bin/bash" > /etc/sudoers.d/repetierserver-bash
When I run external command nothing happens. Log says
Starting external command /var/lib/Repetier-Server/database/turnOnPrinter.sh with 0 parameters.
Tried
<execute>sudo /var/lib/Repetier-Server/database/turnOnPrinter.sh</execute>with same result.
Thank you for help.
Comments
You are not starting /bin/bash but you start /var/lib/Repetier-Server/database/turnOnPrinter.sh so that should be executable.
Then the version with sudo. But remember to restart server before testing or it will not use the sudo version.
The cure is
usermod -a -G gpio repetierserver