Have a script running even with the shell logging out

Hi all,
I wish to have a script running even if my session is disconnected.
I've tried calling another session within it and using sudo to a different user, but it didn't work - as it was expected to do so :rolleyes:

I guess I'll have to work with "nohup" command, right ?
trying with the nohup followed with the script name doesn't seem to work, so I'm thinking in getting my main shell's pid using ps piped to cut and so on and then using this pid as the proc list with the -p option in the nohup command.

That's the easiest way ?
(by the way, there isn't a single command I can issue to obtain the session's pid ? I've been trying ps options but I did not figured out anythying yet :confused: )

thanks in advance,
this site helps a lot.

Hi,

Did you try with & character at the end of your command line ?
Ex: toto.sh &

Rgds.

try this

nohup ksh command &

hope this helps

I was trying something on the way of
nohup -p `ps -u xz1f78 | grep "ksh" | cut -d' ' -f2` $0 ...

but using nohup ksh ... worked.

Thanks a lot. :wink:

Yep, I was using the & character...