dect
/
asterisk
Archived
13
0
Fork 0

Merged revisions 269334 via svnmerge from

https://origsvn.digium.com/svn/asterisk/branches/1.4

........
  r269334 | pabelanger | 2010-06-09 13:24:53 -0400 (Wed, 09 Jun 2010) | 12 lines
  
  Fix Debian init script to not use -c.
  
  When using the init script as-is currently, it could cause issues on Debian
  such as high CPU usage. This fix has worked for several people so I'm
  implementing the change.  We now handle color displays properly.
  
  (closes issue #16784)
  Reported by: pabelanger
  Patches:
        20100530__issue16784__2.diff.txt uploaded by tilghman (license 14)
  Tested by: pabelanger, tilghman
........


git-svn-id: http://svn.digium.com/svn/asterisk/trunk@269346 f38db490-d61c-443f-a65b-d21fe96a405b
This commit is contained in:
pabelanger 2010-06-09 17:32:52 +00:00
parent 3bd233b49d
commit 4dae7fef42
2 changed files with 22 additions and 15 deletions

View File

@ -50,7 +50,7 @@ if ! [ -d $ASTETCDIR ] ; then
exit 0 exit 0
fi fi
# Use the LSB standar functions for services management # Use the LSB standard functions for services management
. /lib/lsb/init-functions . /lib/lsb/init-functions
# Allow configuration overrides in /etc/default/asterisk # Allow configuration overrides in /etc/default/asterisk
@ -76,7 +76,6 @@ case "$1" in
if [ ! -d $ASTVARRUNDIR ]; then if [ ! -d $ASTVARRUNDIR ]; then
mkdir -p $ASTVARRUNDIR mkdir -p $ASTVARRUNDIR
fi fi
if [ $AST_USER ] ; then if [ $AST_USER ] ; then
ASTARGS="-U $AST_USER" ASTARGS="-U $AST_USER"
chown $AST_USER $ASTVARRUNDIR chown $AST_USER $ASTVARRUNDIR
@ -108,13 +107,11 @@ case "$1" in
if [ "x$TEMPRECORDINGLOCATION" = "xyes" -o "x$TMPRECORDINGLOCATION" = "xyes" ]; then if [ "x$TEMPRECORDINGLOCATION" = "xyes" -o "x$TMPRECORDINGLOCATION" = "xyes" ]; then
ASTARGS="$ASTARGS -t" ASTARGS="$ASTARGS -t"
fi fi
# "start-stop-daemon --oknodo" returns 0 even if Asterisk was already running (as LSB expects): if test "x$COLOR" = "xno" ; then
if test "x$COLOR" = "xyes" ; then ASTARGS="$ASTARGS -n"
export TERM=linux
start-stop-daemon --start --oknodo --background --exec $DAEMON -- $ASTARGS -c
else
start-stop-daemon --start --oknodo --exec $DAEMON -- $ASTARGS
fi fi
# "start-stop-daemon --oknodo" returns 0 even if Asterisk was already running (as LSB expects):
start-stop-daemon --start --oknodo --exec $DAEMON -- $ASTARGS
log_end_msg $? log_end_msg $?
;; ;;
stop) stop)

View File

@ -1,7 +1,7 @@
/* /*
* Asterisk -- An open source telephony toolkit. * Asterisk -- An open source telephony toolkit.
* *
* Copyright (C) 1999 - 2005, Digium, Inc. * Copyright (C) 1999 - 2010, Digium, Inc.
* *
* Mark Spencer <markster@digium.com> * Mark Spencer <markster@digium.com>
* *
@ -18,9 +18,9 @@
/*! \file /*! \file
* *
* \brief Terminal Routines * \brief Terminal Routines
* *
* \author Mark Spencer <markster@digium.com> * \author Mark Spencer <markster@digium.com>
*/ */
#include "asterisk.h" #include "asterisk.h"
@ -87,12 +87,21 @@ int ast_term_init(void)
char buffer[512] = ""; char buffer[512] = "";
int termfd = -1, parseokay = 0, i; int termfd = -1, parseokay = 0, i;
if (!term) if (ast_opt_no_color) {
return 0;
if (!ast_opt_console || ast_opt_no_color || !ast_opt_no_fork)
return 0; return 0;
}
for (i=0 ;; i++) { if (!ast_opt_console) {
/* If any remote console is not compatible, we'll strip the color codes at that point */
vt100compat = 1;
goto end;
}
if (!term) {
return 0;
}
for (i = 0;; i++) {
if (termpath[i] == NULL) { if (termpath[i] == NULL) {
break; break;
} }
@ -146,6 +155,7 @@ int ast_term_init(void)
} }
} }
end:
if (vt100compat) { if (vt100compat) {
/* Make commands show up in nice colors */ /* Make commands show up in nice colors */
if (ast_opt_light_background) { if (ast_opt_light_background) {