stubscript


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting stubscript
# 1  
Old 06-09-2008
stubscript

In the past, I have done the following using a large set of case statements, but I've been asked to simplify:

I need to write a bash script that will detect for the existence of other bash scripts which live in a sub-folder and if the script exists in the sub directory, run it. The names for the scripts will be passed to the stubscript from the command line (actually a zenoss monitoring server) they will not be hard coded into the stub script itself. I know this sounds a bit odd, but by using a huge list of case statements, it's not as scalable.

The idea is that you can simply add other bash script inside this subfolder and the stubscript will always stay the same. You then change the command line sent from the monitoring server to the stubscript on the remote server when a fault is detected. The name of the script to be run would come across with the command.
# 2  
Old 06-10-2008
If the script to run is the first command-line argument, then you probably want something like
Code:
[ -f $subdir/$1 ] && bash $subdir/$1

Login or Register to Ask a Question

Previous Thread | Next Thread
Login or Register to Ask a Question