[Pkg-voip-commits] r3296 - asterisk/trunk/debian

Tzafrir Cohen tzafrir-guest at alioth.debian.org
Fri Mar 23 09:54:36 CET 2007


Author: tzafrir-guest
Date: 2007-03-23 08:54:36 +0000 (Fri, 23 Mar 2007)
New Revision: 3296

Modified:
   asterisk/trunk/debian/README.Debian
   asterisk/trunk/debian/asterisk.default
   asterisk/trunk/debian/asterisk.init
   asterisk/trunk/debian/changelog
Log:
* Allow optionally generating core files from standard init.d script.
* Do run Asterisk by default.
* Update documentation in the defaults file and in README.Debian.


Modified: asterisk/trunk/debian/README.Debian
===================================================================
--- asterisk/trunk/debian/README.Debian	2007-03-22 19:31:29 UTC (rev 3295)
+++ asterisk/trunk/debian/README.Debian	2007-03-23 08:54:36 UTC (rev 3296)
@@ -59,7 +59,26 @@
 or
 	http://www.asteriskdocs.org/ (Asterisk Handbook)
 
+safe_asterisk (not so safe)
+===========================
+The asterisk source includes a script called "safe_asterisk" that is 
+intended to run asterisk in a loop in case it ever crashes. 
 
+I (Tzafrir) do not recommend using that script, as it has bad error 
+handling and it is generally badly written. It adds a layer of 
+complexity that does not add much overall sability. All too many times I 
+have found systems where safe_asterisk was running in a loop because, 
+e.g. some configuration eror. The result was that the init.d script of 
+Asterisk has become ineffective. 
+
+If there are any features that safe_asterisk provides that you think
+that the default Asterisk init.d or package should provide by default,
+please let us know. For instance, the package already supports colors
+in the CLI. I don't think that the option -g (to generate core files) 
+be of much help, but if it does, look for core_patterns in the sysctl 
+documentation (http://lxr.linux.no/source/Documentation/sysctl/kernel.txt ).
+
+
 Enjoy your PBX!
 
 Kilian Krause (for the pkg-voip team)

Modified: asterisk/trunk/debian/asterisk.default
===================================================================
--- asterisk/trunk/debian/asterisk.default	2007-03-22 19:31:29 UTC (rev 3295)
+++ asterisk/trunk/debian/asterisk.default	2007-03-23 08:54:36 UTC (rev 3296)
@@ -1,25 +1,35 @@
 # This file allows you to alter the configuration of the Asterisk
-# init.d script
+# init.d script. Normally you should leave the file as-is.
 #
-# RUNASTERISK: run asterisk upon boot. Should be set to "yes" once you have
-#              setup your configuration.
-RUNASTERISK=no
+# RUNASTERISK: If set to anything other that 'yes', the asterisk init.d script
+#              will not run. The default is 'yes'.
+#RUNASTERISK=no
 #
 #
 # AST_REALTIME: if set to anything other than "no", asterisk will run in 
 #               real-time priority (pass '-p' to asterisk). un-rem the 
 #               following line to disable asterisk from running in real-time 
 #               priority
-#AST_REALTIME=yes
+#AST_REALTIME=no
 #
-# PARAMS: extra parameters to pass to asterisk
-#         The example here may help you in debugging, but is 
-#         *not**intended**for**production**use*.
-#         When you give -G *only* that group will be used,
-#         else all groups of the asterisk user.
-#PARAMS="-D -g -vvv"
+# PARAMS: extra parameters to pass to asterisk: generate cores in 
+#         case of crash, and be more verbose. -F guarantees that Asterisk 
+#         will still run daemonized.
 #
+#         Instead of adding switches here, consider editing 
+#         /etc/asterisk/asterisk.conf
+#PARAMS="-F -g -vvv"
 #
+#
 # RUNASTSAFE: run safe_asterisk rather than asterisk (will auto-restart upon
-#             crash)
+#             crash). This is generally less tested and has some known issues
+#             with properly starting and stopping Asterisk.
 #RUNASTSAFE=yes
+#
+# 
+# AST_DUMPCORE: if set to anything other than "no", asterisk will be run with
+#               the option -g (to tell it to dump core on crash) and its
+#               working directory will be set to /var/spool/asterisk, as that
+#               directory is writable and hence core files can be written there.
+#               See /etc/init.d/asterisk for some other relevant variables.
+#AST_DUMPCORE=yes

Modified: asterisk/trunk/debian/asterisk.init
===================================================================
--- asterisk/trunk/debian/asterisk.init	2007-03-22 19:31:29 UTC (rev 3295)
+++ asterisk/trunk/debian/asterisk.init	2007-03-23 08:54:36 UTC (rev 3296)
@@ -27,13 +27,19 @@
 DESC="Asterisk PBX"
 PIDFILE="/var/run/asterisk/asterisk.pid"
 ASTSAFE_PIDFILE="/var/run/asterisk/asterisk_safe.pid"
+PIDFILE_DIR=`dirname $PIDFILE`
 UMASK=007 # by default
 
 
 # by default: use real-time priority
 PARAMS=""
+CHDIR_PARM=""
 AST_REALTIME="yes"
 RUNASTERISK="yes"
+AST_DUMPCORE="no"
+AST_DUMPCORE_DIR="/var/spool/asterisk"
+# core_pattern. See: http://lxr.linux.no/source/Documentation/sysctl/kernel.txt
+#CORE_PATTERN=
 if [ -r /etc/default/$NAME ]; then . /etc/default/$NAME; fi
 
 if [ "$RUNASTERISK" != "yes" ];then
@@ -46,6 +52,19 @@
   PARAMS="$PARAMS -p"
 fi
 
+if [ "$AST_DUMPCORE" != "no" ]
+then
+	PARAMS="$PARAMS -g"
+	if [ "$CORE_PATTERN" != '' ]
+	then
+		echo "$CORE_PATTERN" >/proc/sys/kernel/core_pattern
+	fi
+	if [ -d "$DUMPCORE_DIR" ]
+	then
+		CHDIR_PARM="--chdir $AST_DUMPCORE_DIR"
+	fi
+fi
+
 if [ "x$USER" = "x" ]
 then
   echo "Error: empty USER name"
@@ -72,6 +91,11 @@
 
 test -x $DAEMON || exit 0
 
+if [ ! -d "$PIDFILE_DIR" ];then
+	mkdir "$PIDFILE_DIR"
+	chown $USER:$GROUP "$PIDFILE_DIR"
+fi
+
 set -e
 
 if [ "$UMASK" != '' ]
@@ -120,10 +144,11 @@
 			exit 0
 		fi
 		start-stop-daemon --start --group $GROUP --pidfile "$PIDFILE" \
+			$CHDIR_PARM \
 			--exec $REALDAEMON -- $PARAMS
 	else
 		start-stop-daemon --start --group $GROUP --make-pidfile \
-			--pidfile "$ASTSAFE_PIDFILE" \
+			$CHDIR_PARM --pidfile "$ASTSAFE_PIDFILE" \
 			--exec $REALDAEMON -- $PARAMS
 	fi
 		

Modified: asterisk/trunk/debian/changelog
===================================================================
--- asterisk/trunk/debian/changelog	2007-03-22 19:31:29 UTC (rev 3295)
+++ asterisk/trunk/debian/changelog	2007-03-23 08:54:36 UTC (rev 3296)
@@ -1,3 +1,11 @@
+asterisk (1:1.2.17~dsfg-2) UNRELEASED; urgency=low
+
+  * Allow optionally generating core files from standard init.d script.
+  * Do run Asterisk by default.
+  * Update documentation in the defaults file and in README.Debian.
+
+ -- Tzafrir Cohen <tzafrir.cohe at xorcom.com>  Fri, 23 Mar 2007 10:50:00 +0200
+
 asterisk (1:1.2.17~dsfg-1) unstable; urgency=low
 
   * New upstream release




More information about the Pkg-voip-commits mailing list