mercredi 25 novembre 2015

Linux shell script how would I write "if Nohup" is passed

I have a shell script which invokes a java process which is something like below:

nohup {JAVA_PARAMS} >/dev/null 2>&1 &

The reason the way this written is because the central triggering system does not want to get any response when triggering the command.So I had opted to write the output to null

The problem is that when it comes to testing, the testers would ideally like to have the contents of the script written to a single file for as many JVMs they want.

The only way I could think of doing this would be to add a condition for IF nohup is passed, something like:

OUTPUT=""
IF nohup not passed 
THEN OUTPUT= '>/dev/null 2>&1'
FI
nohup {JAVA_PARAMS} $OUTPUT &

I am welcome to any other suggestions people have but for now I am a little stumped about which direction to go.

Aucun commentaire:

Enregistrer un commentaire