What module to use to execute bash file?

Discussions about RaZberry - Z-Wave board for Raspberry computer
Post Reply
p_carneyrn
Posts: 23
Joined: 06 Sep 2018 13:54

What module to use to execute bash file?

Post 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.
micky1500
Posts: 298
Joined: 07 Feb 2016 16:29
Location: England

Re: What module to use to execute bash file?

Post 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
Raspi 4 - (Buster - 32 Bit) Zwave Version 4.1.1, Raz 7 Pro, Serial API Version: 07.38
p_carneyrn
Posts: 23
Joined: 06 Sep 2018 13:54

Re: What module to use to execute bash file?

Post 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.
User avatar
PoltoS
Posts: 7579
Joined: 26 Jan 2011 19:36

Re: What module to use to execute bash file?

Post by PoltoS »

You need to add this line:
sudo kitchen_night.sh
Post Reply