[Home]

Summary:ASTERISK-17373: [patch] asterisk -rx 'core show version' returns an ANSI string, which is not evaluated correctly with debian init.d script.
Reporter:Alec Davis (alecdavis)Labels:
Date Opened:2011-02-09 14:25:34.000-0600Date Closed:2011-02-10 16:45:25.000-0600
Priority:MinorRegression?No
Status:Closed/CompleteComponents:Core/General
Versions:Frequency of
Occurrence
Related
Issues:
Environment:Attachments:( 0) ast_deb_init.diff
Description:this fails and tries to restart asterisk, although it's already running.<pre>
start)
       # Check if Asterisk is already running.  If it is, then bug out, because
       # starting up Asterisk when Asterisk is already running is very bad.
       VERSION=`${DAEMON} -rx 'core show version' || ${TRUE}`
       if [ "`echo $VERSION | cut -c 1-8`" = "Asterisk" ]; then
               echo "Asterisk is already running.  $0 will exit now."
               exit 1
       fi
...
    # "start-stop-daemon --oknodo" returns 0 even if Asterisk was already running (as LSB expects):
       start-stop-daemon --start --oknodo --exec $DAEMON -- $ASTARGS</pre>


****** ADDITIONAL INFORMATION ******

The workaround is to set nocolor=yes in asterisk.conf

It would be nice to have a colour console, but when a remote command is executed that the response has no ANSI characters in it.

Or even a -n switch, thus the example above becomes;

asterisk -rnx 'core show version'

I also used this as an asterisk-watchdog checking every 5 minutes that she was still running.
Comments:By: Andre Luis (andrel) 2011-02-09 14:52:14.000-0600

1.6 versions have same issue!

By: Leif Madsen (lmadsen) 2011-02-09 14:58:28.000-0600

$ asterisk -rnx 'core show version' does exactly what you want (removes the ANSI colorization)

Perhaps the fix here is just to modify the init.d script to use -rnx instead of -rx.

By: Andrew Latham (lathama) 2011-02-09 15:35:57.000-0600

I just tested this. Will patch and setup

By: Digium Subversion (svnbot) 2011-02-09 15:44:15.000-0600

Repository: asterisk
Revision: 307314

U   branches/1.8/contrib/init.d/rc.debian.asterisk

------------------------------------------------------------------------
r307314 | lathama | 2011-02-09 15:44:14 -0600 (Wed, 09 Feb 2011) | 8 lines

Disable color during running test

(closes issue ASTERISK-17373)
Reported by: alecdavis
Patches:
     ast_deb_init.diff uploaded by lathama (license 1028)
Tested by: andrel, lathama

------------------------------------------------------------------------

http://svn.digium.com/view/asterisk?view=rev&revision=307314

By: Digium Subversion (svnbot) 2011-02-09 15:46:25.000-0600

Repository: asterisk
Revision: 307315

U   trunk/contrib/init.d/rc.debian.asterisk

------------------------------------------------------------------------
r307315 | lathama | 2011-02-09 15:46:25 -0600 (Wed, 09 Feb 2011) | 8 lines

Disable color during running test

(closes issue ASTERISK-17373)
Reported by: alecdavis
Patches:
    ast_deb_init.diff uploaded by lathama (license 1028)
Tested by: andrel, lathama

------------------------------------------------------------------------

http://svn.digium.com/view/asterisk?view=rev&revision=307315

By: Digium Subversion (svnbot) 2011-02-09 15:48:46.000-0600

Repository: asterisk
Revision: 307316

U   branches/1.6.2/contrib/init.d/rc.debian.asterisk

------------------------------------------------------------------------
r307316 | lathama | 2011-02-09 15:48:46 -0600 (Wed, 09 Feb 2011) | 8 lines

Disable color during running test

(closes issue ASTERISK-17373)
Reported by: alecdavis
Patches:
    ast_deb_init.diff uploaded by lathama (license 1028)
Tested by: andrel, lathama

------------------------------------------------------------------------

http://svn.digium.com/view/asterisk?view=rev&revision=307316

By: Digium Subversion (svnbot) 2011-02-10 16:33:11.000-0600

Repository: asterisk
Revision: 307534

U   branches/1.4/main/asterisk.c

------------------------------------------------------------------------
r307534 | qwell | 2011-02-10 16:33:10 -0600 (Thu, 10 Feb 2011) | 8 lines

Remove color when executing commands via a remote console.

Essentially this makes '-x' imply '-n' on rasterisk.  This was done in a
different and incomplete way previously, which I'll be reverting shortly.

(issue ASTERISK-17373)
Reported by: alecdavis

------------------------------------------------------------------------

http://svn.digium.com/view/asterisk?view=rev&revision=307534

By: Digium Subversion (svnbot) 2011-02-10 16:35:50.000-0600

Repository: asterisk
Revision: 307535

_U  branches/1.6.2/
U   branches/1.6.2/contrib/init.d/rc.debian.asterisk
U   branches/1.6.2/main/asterisk.c

------------------------------------------------------------------------
r307535 | qwell | 2011-02-10 16:35:49 -0600 (Thu, 10 Feb 2011) | 15 lines

Merged revisions 307534 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
 r307534 | qwell | 2011-02-10 16:33:09 -0600 (Thu, 10 Feb 2011) | 8 lines
 
 Remove color when executing commands via a remote console.
 
 Essentially this makes '-x' imply '-n' on rasterisk.  This was done in a
 different and incomplete way previously, which I'm reverting here.
 
 (issue ASTERISK-17373)
 Reported by: alecdavis
........

------------------------------------------------------------------------

http://svn.digium.com/view/asterisk?view=rev&revision=307535

By: Digium Subversion (svnbot) 2011-02-10 16:39:31.000-0600

Repository: asterisk
Revision: 307536

_U  branches/1.8/
U   branches/1.8/contrib/init.d/rc.debian.asterisk
U   branches/1.8/main/asterisk.c

------------------------------------------------------------------------
r307536 | qwell | 2011-02-10 16:39:31 -0600 (Thu, 10 Feb 2011) | 22 lines

Merged revisions 307535 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.6.2

................
 r307535 | qwell | 2011-02-10 16:35:49 -0600 (Thu, 10 Feb 2011) | 15 lines
 
 Merged revisions 307534 via svnmerge from
 https://origsvn.digium.com/svn/asterisk/branches/1.4
 
 ........
   r307534 | qwell | 2011-02-10 16:33:09 -0600 (Thu, 10 Feb 2011) | 8 lines
   
   Remove color when executing commands via a remote console.
   
   Essentially this makes '-x' imply '-n' on rasterisk.  This was done in a
   different and incomplete way previously, which I'm reverting here.
   
   (issue ASTERISK-17373)
   Reported by: alecdavis
 ........
................

------------------------------------------------------------------------

http://svn.digium.com/view/asterisk?view=rev&revision=307536

By: Digium Subversion (svnbot) 2011-02-10 16:45:25.000-0600

Repository: asterisk
Revision: 307537

_U  trunk/
U   trunk/contrib/init.d/rc.debian.asterisk
U   trunk/main/asterisk.c

------------------------------------------------------------------------
r307537 | qwell | 2011-02-10 16:45:25 -0600 (Thu, 10 Feb 2011) | 29 lines

Merged revisions 307536 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.8

................
 r307536 | qwell | 2011-02-10 16:39:30 -0600 (Thu, 10 Feb 2011) | 22 lines
 
 Merged revisions 307535 via svnmerge from
 https://origsvn.digium.com/svn/asterisk/branches/1.6.2
 
 ................
   r307535 | qwell | 2011-02-10 16:35:49 -0600 (Thu, 10 Feb 2011) | 15 lines
   
   Merged revisions 307534 via svnmerge from
   https://origsvn.digium.com/svn/asterisk/branches/1.4
   
   ........
     r307534 | qwell | 2011-02-10 16:33:09 -0600 (Thu, 10 Feb 2011) | 8 lines
     
     Remove color when executing commands via a remote console.
     
     Essentially this makes '-x' imply '-n' on rasterisk.  This was done in a
     different and incomplete way previously, which I'm reverting here.
     
     (issue ASTERISK-17373)
     Reported by: alecdavis
   ........
 ................
................

------------------------------------------------------------------------

http://svn.digium.com/view/asterisk?view=rev&revision=307537