[Asterisk-Dev] [BUG] Asterisk -r removes main pid

Brancaleoni Matteo mbrancaleoni at espia.it
Sun Jun 22 06:13:54 MST 2003


This simple patch solves that, where simply we don't unlink
the pid file if closing a remote console (!option_remote).

don't know if a separate pidfile would be useful...

Matteo.

Il dom, 2003-06-22 alle 12:54, Brancaleoni Matteo ha scritto:
> Hi.
> I've noticed that when connecting to a main asterisk
> proc via asterisk -r (unix remote console), on exit
> the pid file (/var/run/asterisk.pid) is removed ...
> that's bad since the pid is used by the main 
> asterisk, not by the unix console.
> Also this could be a problem when using monitoring
> tools like monit that relies on pid file for
> checking if the proc is alive or not... as
> the first time a unix console connection is made,
> the pid is removed and the monitoring process restarts
> asterisk...
> 
> Perhaps we can use a different pid file for asterisk -r ?
> 
> Matteo.
> 
> _______________________________________________
> Asterisk-Dev mailing list
> Asterisk-Dev at lists.digium.com
> http://lists.digium.com/mailman/listinfo/asterisk-dev
-------------- next part --------------
--- asterisk/asterisk.c	2003-06-22 15:09:52.000000000 +0200
+++ myasterisk/asterisk.c	2003-06-22 15:09:03.000000000 +0200
@@ -425,7 +425,7 @@
 		close(ast_consock);
 	if (ast_socket > -1)
 		unlink((char *)ast_config_AST_SOCKET);
-	unlink((char *)ast_config_AST_PID);
+	if(!option_remote) unlink((char *)ast_config_AST_PID);
 	printf(term_quit());
 	if (restart) {
 		if (option_verbose || option_console)


More information about the asterisk-dev mailing list