Salandora / OctoPrint-SystemCommandEditor

This plugin makes System Commands editable through the OctoPrint WebUI
GNU Affero General Public License v3.0
9 stars 9 forks source link

Howto execute bash Script? #10

Closed carlymx closed 6 years ago

carlymx commented 6 years ago

Hello,

I have a script to start 'Motion' and I would like to know what would be the command line that dev use to make the plugin work.

Everything I've tried sends me the same error, when the terminal works perfectly.

Error:
The command "WebCam ON" could not be executed.
More...

Command for custom:Start Motion failed with return code 1:
STDOUT: Must be connected to a terminal.
STDERR: 

The Script is very simple and as it says it works perfectly in the terminal:

#!/bin/bash
### BEGIN INIT INFO
# Provides: motion_start
# Required-Start: $syslog
# Required-Stop: $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: start Motion
# Description:
#
### END INIT INFO

screen -S motion -A -m \
motion \

The command lines I use in the plugins are the following:

sudo  /home/orangeprint/scripts/motion.sh
sudo bash /home/orangeprint/scripts/motion.sh

I hope you can help me thanks

Salandora commented 6 years ago

Well, both of your commands seem to work. But problem seems to be with screen requireing a bit more then octoprint offers it.

Maybe you should convert your script to either a systemd service file or a real initd service file and let octoprint run "service start "