When I run
nohup sudo myscript.sh &
I only get something like
[1] 1220
in return and do not get prompted for a password. The process does not start either.
I want to run this script in the background and it needs to be run under sudo.
Anybody guess what I am doing wrong? Using OSX Mountain Lion (Darwin).
Best Answer
The problem is that you are putting
sudo
in background. I see two ways to solve this problem:bg
so the job resumes running in the background ;sudo
before (likesudo ls
), then launch yournohup
command, and it won't ask for your password again and will run anyway.