Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
The script essentially runs a java program in the client machine abc.def.edu and outputs the PID of this process to a file. [We know $! holds the PID of the last spawned process. ]
However while running this script, I find that JAVAParent isn't holding any value. In fact while I debug this script using bash -x script.sh, I find that the line corresponding to JAVAParent=$! is shown as JAVAParent= ; (there is no $! here!).
The $! is being evaluated before being sent as part of the command line. Use hard (single) quotes around the command line to stop this. i.e.
ssh -f xyz@abc.def.edu 'cd /home/xyz/; nohup java -Xmx1024m abc <ParamFile> & JAVAParent=$!; echo $JAVAParent >> parentPID.txt'
That program actually runs for hours! However I would like to have some other process run parallely in another client using the process id of this parent process. That is why, I made it nohup and ended it with &.
I would greatly appreciate any help as I have been stuck with this for two days now!
That program actually runs for hours! However I would like to have some other process run parallely in another client using the process id of this parent process. That is why, I made it nohup and ended it with &.
I would greatly appreciate any help as I have been stuck with this for two days now!
Does the code actually work if you run it interactively?
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.