Strange behavior of pidof function

Discussion in 'Programming/Scripts' started by Poliman, May 21, 2018.

  1. Poliman

    Poliman Member

    I have a script which checks that some node server process is running or not. I use pidof function, i.e.
    Code:
    pidof dziup-server-prod.js
    As you can see there is full server name with file extension. But for some names I have to use shorter name, because pidof does not find the process. I have this issue with, i.e.
    Code:
    quiz3m-server-test.js
    Pidof finds the process when I put as parameter shorter name like
    Code:
    quiz3m-server-tes
    Below you can see the examples:
    Code:
    root@s1:~/skrypty# pidof quiz3m-server-test.js
    root@s1:~/skrypty# pidof quiz3m-server-test.j
    root@s1:~/skrypty# pidof quiz3m-server-test
    root@s1:~/skrypty# pidof quiz3m-server-tes
    3945
    root@s1:~/skrypty# pidof dziup-server-prod.js
    30636
    root@s1:~/skrypty# pidof quiz3m-server-prod.js
    11807
    
    I don't understand why pidof works this way. I attached screens with more informations.

    PS
    Path and name of each server file mentioned above:
    /var/www/clients/client4/web4/web/tquiz3m/quiz3m-server-test.js
    /var/www/clients/client30/web88/web/dziup-server-prod.js
     

    Attached Files:

    Last edited: May 24, 2018

Share This Page