Hi,
I have a strange problem.
In my shell script, i am startting another program (a c++ exe) with nohup .
I am getting the process id of this started process with using $!
I am writing this process id into another file so that i can keep checking for this process ids to check whether the process is completed.
Additionally, the c++ exe also writes its process id into the log file.
When i check the process ids that i am capturing from the shell script and the process id from the log file of the exe, both are not matching.
Process id from the shell script is the parent process id not the child's process id.
Could someone please tell me what is wrong wiht my approach and how to get the process id of the child process accuraetly in my script.
below is the piece of shell script that i m using:
### Shell Script ########
nohup BDE arg1 arg2 arg3 &
proc_id=`echo $!`
echo $proc_id >> proc_id_file
###### code in c++ to get process id ####
process_id = getpid();