Home » Questions » Computers [ Ask a new question ]

Issues ending script with tail -f

Issues ending script with tail -f

I use the following script to restart a Java server running on a Solaris Sun 5.10 box...

Asked by: Guest | Views: 277
Total answers/comments: 1
Guest [Entry]

"While screen is probably the best way to handle this, one alternative, if you're scripting with bash, would be to disown your start_java.sh process after starting it. This disassociates the process from the terminal, so when you close PuTTY any SIGKILL sent to running processes will not be sent to that process.

Another alternative would be to use tcsh, which automatically disowns backgrounded processes when it exits, instead of SIGKILL'ing them.

I think you can just add disown into your script like this:

#!/bin/bash
# might need to specify bash in the line above for this to work right

pkill -9 java
nohup ./start_java.sh &
disown

tail -f smx.log"