1

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

1
  • It would help if you said what it's doing or not doing that's different from what you expect. Your question is very vague. Commented Dec 9, 2009 at 12:22

2 Answers 2

3

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.

Sign up to request clarification or add additional context in comments.

Comments

2

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 ;)

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.