Page 1 of 1

What module to use to execute bash file?

Posted: 18 Jun 2020 18:28
by p_carneyrn
I've written some .sh files to run specific commands. I know how to execute them from PUTTY when I ssh into the system, but can't figure out which module and what is the command to run from inside the zway server program. It's a novice question, but any help would be appreciated. Thanks.

Re: What module to use to execute bash file?

Posted: 18 Jun 2020 19:46
by micky1500
Use the App - Code device
put your command in the action area
e.g. system("echo IRCODE STANDBY | telnet 192.168.1.10 31339")
you also need to allow the command in .syscommands
just add your command to the list, like echo, or sudo echo
nano /opt/z-way-server/automation/.syscommands

I moved my executables to this folder /usr/local/bin/ Saves having to tell it the full path. Raspberry already has this path set.

Use this command in ssh to watch and find the errors:-
tail -f /var/log/z-way-server.log | bash ./colorize-log.sh -c -q -z core

Re: What module to use to execute bash file?

Posted: 21 Jun 2020 23:13
by p_carneyrn
Awesome. Thanks for the info. I've been playing around with it this weekend. I created an executable shell script and it is located in /usr/local/bin/. It works when I put sudo kitchen_night.sh in a command line. But I need a little help from there.

I created a code device with the line system("sudo kitchen_night.sh"). Is that correct?

Also, what is the exact line I add to .syscommands file to make it work?

Thanks in advance.

Re: What module to use to execute bash file?

Posted: 22 Jun 2020 02:49
by PoltoS
You need to add this line:
sudo kitchen_night.sh