Jump to content

pid file not removed after pbx is stopped


Recommended Posts

Hi,

 

As the title states the pid file is not removed when you stop pbx, see below

 

[root@node-01 pbxnsip]# ./pbx_01 --pidfile /var/run/pbx_01.pid

 

[root@node-01 pbxnsip]# pidof -c -o $$ -o $PPID -o %PPID -x pbx_01

15791

[root@node-01 pbxnsip]# cat /var/run/pbx_01.pid

15791[root@node-01 pbxnsip]#

 

[root@node-01 pbxnsip]# ps -ef|grep pbx_01

root 15791 1 1 15:57 pts/0 00:00:00 ./pbx_01 --pidfile /var/run/pbx_01.pid

root 16296 23656 0 15:57 pts/0 00:00:00 grep pbx_01

 

[root@node-01 pbxnsip]# kill -TERM 15791

 

[root@node-01 pbxnsip]# cat /var/run/pbx_01.pid

1579

 

[root@node-01 pbxnsip]# pidof -c -o $$ -o $PPID -o %PPID -x pbx_01

 

[root@node-01 pbxnsip]# ps -ef|grep pbx_01

root 16895 23656 0 15:58 pts/0 00:00:00 grep pbx_01

 

[root@node-01 pbxnsip]# ./pbx_01 --version

Version: 3.4.0.3201

 

The LSB specification states that "When a program is stopped, it should delete its pidfile"

 

Does anyone know if this is solved in any newer releases?

Link to comment
Share on other sites

The LSB specification states that "When a program is stopped, it should delete its pidfile"

 

Hmm. When the program receives a signal, it usually performs the default action. In other words when it crashes, it does not delete the PID file... Maybe we have to define what signal should be used to shut the service down and then the pidfile can be deleted in a controlled way.

Link to comment
Share on other sites

Hmm. When the program receives a signal, it usually performs the default action. In other words when it crashes, it does not delete the PID file... Maybe we have to define what signal should be used to shut the service down and then the pidfile can be deleted in a controlled way.

 

when a program crashes, I don't expect to remove the pid file. But if it is terminated gracefully, normal stop, I expect the pid file to be removed.

The presents of a pid file on unix systems is quite significant.

 

Nevertheless, I managed to do my work even with this behavior. I created a LSB compliant init script for pbx, I had to that because the current scripts on the site aren't and it was a requirement from the cluster software to use LSB compliant init script.

Link to comment
Share on other sites

[...]

[root@node-01 pbxnsip]# kill -TERM 15791

 

looking at my init script[2] of pbxnsip I see it uses the killproc funtion[1] which first sends a TERM signal then deletes the pid file.

 

Nick

 

_____________________

[1] have a look at /etc/rc.d/init.d/functions

 

[2]

...

stop()

{

echo -n "Stopping pbxnsip Watchdog:"

killproc $PBXWD -TERM

echo

RETVAL=1

}

...

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...