0

I want to create an executable file. The goal should be to execute multiple console scripts (.sh) one after the another. The difficulty, however, is that each sh command should be executed by a new command tab. Specifically, among other things I want to create a script for the second step of the manual (https://kafka.apache.org/quickstart). Is this even possible?

Thanks in advance!

Edit:so far i tried to write a script to execute two sh files using mate-terminal:

#!/bin/bash
mate-terminal --working-directory="/home/user/Documents/kafka_2.11-2.0.0/bin"  --command "zookeeper-server-start.sh config/zookeeper.properties"
mate-terminal --working-directory="/home/user/Documents/kafka_2.11-2.0.0/bin"  --command "kafka-server-start.sh config/server.properties"

Unfortunately this bash always results in the following error message for both sh files:

There was an error creating the child process for this terminal Failed to execute child process “kafka-server-start.sh” (No such file or directory)

There was an error creating the child process for this terminal Failed Failed to execute child process “zookeeper-server-start.sh” (No such file or directory)

4
  • 1
    What's a "command tab"? A script is a collection of commands by definition. And scripts are just commands themselves, so there's nothing complicated about a bash script running other bash scripts. I don't understand what the issue is. Could you edit and clarify? Perhaps with a specific example, showing us how what you tried fails?
    – terdon
    Feb 23, 2019 at 17:54
  • thanks for the information, I posted my current script above
    – Leon
    Feb 23, 2019 at 18:24
  • Why are you running the command's in terminals? If you want this to run at boot, the GUI won't have loaded yet so you can't open a terminal.
    – terdon
    Feb 23, 2019 at 18:30
  • at first i wanted to try to make the sh files run on a terminal. in the second step then i want to try to execute the sh files automatically when starting the server.
    – Leon
    Feb 23, 2019 at 18:33

1 Answer 1

4

Try this Leon

#!/bin/bash
mate-terminal --working-directory="/home/user/Documents/kafka_2.11-2.0.0/bin"  --command "/home/user/Documents/kafka_2.11-2.0.0/bin/zookeeper-server-start.sh config/zookeeper.properties"
mate-terminal --working-directory="/home/user/Documents/kafka_2.11-2.0.0/bin"  --command "/home/user/Documents/kafka_2.11-2.0.0/bin/kafka-server-start.sh config/server.properties"

The error is saying already that it cannot find the two scripts so you need to set full path of the scripts. I am not sure about the path of the config/ properties files but these also need to be set to full path.

10
  • thank you for your suggestion. Now two terminals are opened and no error message appears, but I don't get any feedback when executing the single sh files. So I can't check if the two sh files are executed without errors.
    – Leon
    Feb 23, 2019 at 18:53
  • please adjust the properties paths /home/user/Documents/kafka_2.11-2.0.0/config/zookeeper.properties probably for example also for the logs you can point it to > logfile.log for example and have the full output
    – Alpy
    Feb 23, 2019 at 18:57
  • thanks for the hint - now it works. One more question, how can I force the terminal to remain open even after the sh command is finished?
    – Leon
    Feb 23, 2019 at 19:03
  • add a ';bash' after each of the 2 comands just after the properties but in the same brackets
    – Alpy
    Feb 23, 2019 at 19:12
  • I have already tried the ";bash" command but unfortunately the terminal still closes directly after the execution of the sh.
    – Leon
    Feb 23, 2019 at 19:25

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .