amuck-landowner

Bash scripts

toadyus

Article Submitter
Anyone know how to queue a bunch of bash scripts? I want to call one that then calls another one but have the first one close or exit when running the next one.

Thanks.
 

toadyus

Article Submitter
never mind I figured out a really fast way of processing scripts in the back ground using the following command:

sh -c 'cd \"folder where script is"; nohup ./"Script you want to run" > /dev/null 2>&1 &'
 

raindog308

vpsBoard Premium Member
Moderator
Anyone know how to queue a bunch of bash scripts? I want to call one that then calls another one but have the first one close or exit when running the next one.
Isn't what you're asking something like:


#!/bin/bash

first_script.sh
second_script.sh
third_script.sh

?  That will run each in sequence.  Or if you don't know the names of the scripts in advance:


for script in `ls /some/path/*.sh` ; do ${script} ; done
If you care about order of execution, you can name them specially and play with sort.
 
Last edited by a moderator:

toadyus

Article Submitter
Nah my problem was that I didn't want the main script that was being called to still be open while the others were being ran. By throwing them into nohup this works like a charm for me as they will all run in the background.

I'm calling the scripts from a website and the page would hang until the scripts were finished. By putting the scripts in the background the user doesn't have to wait for the scripts to finish and will now never know what is happening.
 
Top
amuck-landowner