Starting Asterisk
- -c: Console mode. Don't go into background mode, stay in foreground with a command line interface (implies -f)
- -C <filename>: Start Asterisk with a specified configuration file
- -d: Debug mode
- -f: Stay in foreground mode
- -g: Dump core in case of a crash
- -h: Help (list all command line options).
- -i: Initializie crypto keys at startup
- -p: Run as pseudo-realtime thread
- -q: Quiet mode
- -v: The verbose command. Add more 'v':s to get more messages.
Connecting to a running Asterisk
- -r:Connect to Asterisk running in the background and present a command line interface
- -R:Same as -r, but will automatically reconnect to the daemon (or at least retry) if the daemon restarts
- -x:In combination with -r, execute an Asterisk CLI command
- -n:Disable ANSI colour support
Examples
- asterisk -vvvvvvdr:Start a very chatty Asterisk command line interface and connect to asterisk running in the background
- asterisk -vvvvvvc:Start Asterisk PBX, don't go background
- asterisk -rx reload:Connect to a running Asterisk, force reload of configuration with the CLI command "reload"

Comments
333my init.d script
- Source function library.
. /etc/rc.d/init.d/functionsasterisk=/usr/sbin/asterisk
prog=Asterisk
pidfile=/var/run/asterisk.pid
lockfile=/var/lock/subsys/asterisk
RETVAL=0
start() {
echo -n $"Starting $prog: "
daemon $asterisk $OPTIONS
RETVAL=$?
echo
$RETVAL = 0 && touch ${lockfile}
return $RETVAL
}
stop() {
echo -n $"Stopping $prog: "
killproc $asterisk
RETVAL=$?
echo
$RETVAL = 0 && rm -f ${lockfile} ${pidfile}
}
reload() {
echo -n $"Reloading $prog config files "
$asterisk -rx reload
RETVAL=$?
echo
}
- See how we were called.
case "$1" instart)
start
;;
stop)
stop
;;
restart)
stop
start
;;
reload)
reload
;;
*)
echo $"Usage: $prog {start|stop|restart|reload}"
exit 1
esac
exit $RETVAL