Question

I have bash script which works well but when I send it back with nohup script & and close my terminal session then it's not working correctly. It only works well within my terminal session open.

What could be possible reasons which affects my script run not correctly without my terminal session? Could it be one of the terminal variables or something?

solaris 10

Was it helpful?

Solution

call:

script &
disown $!

& launches your script in the background and disown $! detaches last executed command from the current shell. $! is the PID of the last background executed command.

OTHER TIPS

Without the source we can only make guesses. However, your usecase might be a good fit for using GNU Screen: http://www.gnu.org/software/screen/ You can detach shell sessions from your current login and pick them up later on.

In my humble opinion one of the most useful programs on earth ;)

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top