Can anyone help me with this issue? As this is being a road block for me, where I am able to run the commands in non-root login, but not from root with sudo or su command.
I think you would get that error if pg_ctl is unable to stat itself, which might be due to a permissions problem. Are you sure the shahid user can read/exec all the directories in that path (particularly /root)?