-1

SO I have a BSD server and want to host a Minecraft BungeeCoord server. The thing is the server files are in different directories EG: /home/name/bungee/servers/Survival/start.sh AND /home/name/bungee/servers/Lobby/start.sh

Is there a way to make a file that can run multiple files from different directories ?

Just to make it clear, the reason I want to do this is because the BSD server can only take 1 file at a time, like shell/terminal.

Edit: The command I ended up using was screen

  • "because the BSD server can only take 1 file at a time" -- What do you want to say with that? What is "taking" a file supposed to mean? – sticky bit Feb 12 '21 at 01:06
  • Sorry for the confusion, I meant that I need to run multiple .sh files and I don't know how – Yaroslav .O Feb 12 '21 at 01:11
  • And the files are in different directories – Yaroslav .O Feb 12 '21 at 01:12
  • ... by calling each one? – sticky bit Feb 12 '21 at 01:12
  • So when you run a file in the terminal, you can only run one .sh file not multiple – Yaroslav .O Feb 12 '21 at 01:13
  • And I need to run like 6 .sh files in different directories at the SAME time – Yaroslav .O Feb 12 '21 at 01:13
  • You want the process to run in the background? There are a variety of possibilities. Using ` &` at the end of the command, using `nohup`, checking if the program itself can be daemonized by a flag, etc.... Do some research. – sticky bit Feb 12 '21 at 01:16
  • Let us [continue this discussion in chat](https://chat.stackoverflow.com/rooms/228605/discussion-between-yaroslav-o-and-sticky-bit). – Yaroslav .O Feb 12 '21 at 01:16
  • @Yaroslav.O : So your question boils down to run several processes in paralel. I don't see how this is realated to minecraft, but parallel execution is explained pretty well [here](https://www.cyberciti.biz/faq/how-to-run-command-or-code-in-parallel-in-bash-shell-under-linux-or-unix/). – user1934428 Feb 12 '21 at 08:29

1 Answers1

0

somewhat sorted by least to most advanced

example 1

sh /home/name/bungee/servers/Survival/start.sh &
sh /home/name/bungee/servers/Lobby/start.sh &

& runs the process as a background job freeing the terminal (STDIN) though not STDOUT and STDERR streams meaning the output still goes to the terminal

use jobs(1) command of ksh(1) (OpenBSD default shell) to view those jobs controllable by your shell afterwards

example 2

after cd path gets shorter

  cd /home/name/bungee/servers
  sh ./Survival/start.sh &
  sh ./Lobby/start.sh &

you may also redirect both output to file instead of to the screen using the redirection capability of your shell such as with > output.log 2>&1

example 3

use multiple (virtual) terminals? (ctrl+alt+f1 and ctrl+alt+f2) logging in into each separately, and then launch a script per tty(4)

example 4

use a programming language library such as IPC::Cmd to fork processes with run_forked function

Elvin
  • 166
  • 7
  • `for` loop (with `find(1)`) and wildcard (`*`) are also options for multiple files TMTOWTDI – Elvin Apr 05 '21 at 09:32