[Asterisk-code-review] ast coredumper: Refactor the pid determination process (asterisk[13])

Sean Bright asteriskteam at digium.com
Mon Dec 24 13:17:16 CST 2018


Sean Bright has uploaded a new patch set (#2) to the change originally created by George Joseph. ( https://gerrit.asterisk.org/10830 )

Change subject: ast_coredumper:  Refactor the pid determination process
......................................................................

ast_coredumper:  Refactor the pid determination process

In order to get a dump of the running process, we need to find the
pid of the main asterisk process.  This can be tricky if there are
also instances of "asterisk -r" running or if an alternate location
for asterisk.conf was specified on the command line with the -C
option that also specified an alternation location for the pid file.

So now...

1. We find the asterisk executable with "which" or the --asterisk-bin
   command line option.
2. If there's only 1 process with an executable path that matches,
   we use that pid.  If not...
3. We try "<asterisk-bin> -rx 'core show settings'" and parse the
   output to find the pidfile, then read that for the pid.  If that
   didn't work...
4. We get a list of all the pids matching <asterisk-bin> and look
   in /proc/<pid>/cmdline for a -C argument and retry the "core show
   settings" using the same -C option.  We can't parse the output
   of "ps" to get the -C path because it may contain spaces.  The
   contents of /proc/<pid>/cmdline are delimited by NULLs.  For BSDs
   we may have to mount /proc first. :(

ASTERISK-28221
Reported by: Andrew Nagy

Change-Id: I8aa1f3f912f949df2b5348908803c636bde1d57c
---
M contrib/scripts/ast_coredumper
1 file changed, 84 insertions(+), 29 deletions(-)


  git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/30/10830/2
-- 
To view, visit https://gerrit.asterisk.org/10830
To unsubscribe, or for help writing mail filters, visit https://gerrit.asterisk.org/settings

Gerrit-Project: asterisk
Gerrit-Branch: 13
Gerrit-MessageType: newpatchset
Gerrit-Change-Id: I8aa1f3f912f949df2b5348908803c636bde1d57c
Gerrit-Change-Number: 10830
Gerrit-PatchSet: 2
Gerrit-Owner: George Joseph <gjoseph at digium.com>
Gerrit-Reviewer: Friendly Automation (1000185)
Gerrit-Reviewer: Sean Bright <sean.bright at gmail.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20181224/8549dcfd/attachment.html>


More information about the asterisk-code-review mailing list