I am using a certain tool which executes via an agent on the Linux servers. We could execute it manually by logging into the Linux servers too.
I am trying to figure out (via Linux shell script) whether a user is logged in or whether the process is being invoked via the agent. Depending on this I want to execute different parts of the code.
Is there a variable in linux which helps ascertain this ?
pstree --show-parents on the process ID. This will tell you what process started the program.
$ pstree -s 18445 systemd───sshd───sshd───sshd───bash $ pstree -s 21797 systemd───nginx───nginx
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.