Looks like you're working with some batch system. BWDEXPMGMT looks like a maestro job name to me! MGMT = management? EXP = export? BWD? Hmm. I've spent way too long in the past trying to work out the purpose of some undocumented job from the job name. *sigh*
ANYhow... There are a few things which are wrong here.
- I think you want a space between /usr/bin/nohup and the command name "./hawkagent_$bwdom". If this is a typo, please please please - when putting failing example code into the forums copy-paste it. If that's not possible for some reason, at least copy it carefully.
- You can't do backgrounding with `command substitution`. Well, you can but only in order to run multiple commands within that command substitution. The `` statement will wait until all processes spawned by the `` have completed before returning. This makes sense because the `` evaluates to the output of the commands in the back-quotes, so it can't know what the output is until the command is complete.
If you want to get the PID of the backgrounded process, try this. Note it will only work if you only have one
backgrounded process from the script:
nohup /usr/bin/nohup ./hawkagent_$bwdom &
By the way, when trying to make daemon processes, please consider following the advice in this document
. There's a right way of making daemon processes, and "nohup command &" isn't it!