Page 86 - Asterisk™: The Future of Telephony
P. 86

-g
                   Core dump. If Asterisk were to crash unexpectedly, this would cause a core file to
                   be created for later tracing with gdb. You generally do not use this in production,
                   unless you are writing code for Asterisk and want to debug any resulting crashes.

               -r
                   Remote. This is used to reconnect remotely to an already running Asterisk process.
                   (The process is remote from the standpoint of the console connecting to it but is
                   actually a local process on the machine. This has nothing to do with connecting to
                   a remote process over a network using a protocol such as IP, as this is not suppor-
                   ted.) This is the most common option and it is what you would use to connect to
                   Asterisk on a system where it is running as a daemon/service that was started by
                   init at boot time.
               -x "<CLI command>"
                   Execute. Using this command in combination with -r allows you to execute a CLI
                   command without having to connect to the CLI and type it manually. An example
                   would  be  to  send  a  restart,  which  you  would  do  by  typing  asterisk -rx
                   "reload" from the command line.
               Let’s look at some examples. If you want to start Asterisk as a user program (because
               you are tweaking your config and will be starting and stopping it several times), and
               you want a verbosity level of 3, use the following command:

                   # /usr/sbin/asterisk -cvvv
               If the Asterisk process is already running (for example, if you have installed Asterisk as
               part of the init process of the system), use the reconnect switch, like so:
                   # /usr/sbin/asterisk -vvvr
               If you want Asterisk to dump a core file after a crash, you can use the -g switch when
               starting Asterisk:
                   # /usr/sbin/asterisk -g
               To execute a command without connecting to the CLI and typing it (perhaps for use
               within a script), you can use the -x switch in combination with the -r switch:
                   # /usr/sbin/asterisk -rx "restart now"
                   # /usr/sbin/asterisk -rx "database show"
                   # /usr/sbin/asterisk -rx "sip show peers"
               If you are experiencing crashes and would like to output to a debug file, use the fol-
               lowing command:
                   # /usr/sbin/asterisk -vvvvc | tee /tmp/debug.log
               Note that you do not have to use the v switch if you do not want the system to provide
               detailed output of what is going on. On a busy system, you may not want to get any
               output, as it can interfere with whatever you are doing on the console.




               58 | Chapter 3: Installing Asterisk
   81   82   83   84   85   86   87   88   89   90   91