centos – Full path to running script?

Your script doesn’t seem to be running here, the process displayed as output is grep and not your script.

Let’s try to explain with an example:

I use grep to find if the process script.sh is running, I use the following command :

ps -ef | grep script.sh

If the process is running you will have the following result :

  • The process (script.sh)
  • The grep process searching for script.sh

Like this :

root      842310  842214  0 08:14 pts/2    00:00:00 /bin/bash ./script.sh
root      842338  842299  0 08:14 pts/4    00:00:00 grep --color=auto script.sh

The process with PID 842310 is my running script.

So make sure your script is running 😉

For the path I don’t know if you can get it. I have tried several methods but have not succeeded.

Read more here: Source link