[asterisk-users] Re: How to exit from console?

Tzafrir Cohen tzafrir.cohen at xorcom.com
Sun Jan 28 04:17:18 MST 2007


On Sun, Jan 28, 2007 at 12:41:30PM +0200, Oded Arbel wrote:
> On Thu, 2007-01-25 at 18:01 +0200, Tzafrir Cohen wrote:
> > On Thu, Jan 25, 2007 at 01:37:50PM +0100, Tomislav Parčina wrote:
> > > In article <20070123131921.GT18852 at xorcom.com>, tzafrir.cohen at xorcom.com says...
> > > > > Try safe_asterisk , for an easy way to start asterisk in background, 
> > > > 
> > > > a plain 'asterisk' is even better and safer.
> > > > asterisk -U asterisk . is better. 
> > > >   /etc/init.d/asterisk start
> > > > is similar.
> > > 
> > > Why is this better than safe_asterisk?
> 
> the init.d init scripts bundled with asterisk are using safe_asterisk
> and not calling the asterisk binary directly.

Those scripts will use either asterisk or safe asterisk. It depends if
safe_asterisk is executable (which implies that it was installed).

> 
> > E.g: because you have a valid PID file of the controlling process. If
> > you actually want to kill it, you can.
> 
> Granted, its a good idea. the init.d scripts bundled with asterisk kill
> safe_asterisk, which apparently works just as well (haven't looked at
> safe_asterisk code, but its probably killing its child when it is being
> killed, which should work well for any situation other then kill -9).

Let's look at the "stop" target of those robust scripts.

The Debian one:

  stop)
	echo -n "Stopping $DESC: "
	$DAEMON -rx 'stop now' > /dev/null 2> /dev/null && echo -n "$NAME"
	echo "."
	exit 0
	;;

Cool. If asterisk goes bezerk, it will go bezerk as well. With proper timing of 
concurrent calls to this script you can have some fun.

Here is the "redhat" one:

stop() {
	# Stop daemons.
	echo -n $"Shutting down asterisk: "
	killproc asterisk
	RETVAL=$?
	[ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/asterisk
	echo
	return $RETVAL
}



> 
> > And you don't need physical access to the system to get to the one and
> > only real console. OTOH, if you do have physical access, you have full
> > control of Asterisk, as you may inject custom dialplan.
> 
> I wasn't aware that running asterisk -r on a physical tty has any
> advantages over running asterisk -r on a remote shell.

No. But if you're not going to use the local console anyway, why run it? 
To allow intruders control of your Asterisk?

-- 
               Tzafrir Cohen       
icq#16849755                    jabber:tzafrir at jabber.org
+972-50-7952406           mailto:tzafrir.cohen at xorcom.com       
http://www.xorcom.com  iax:guest at local.xorcom.com/tzafrir


More information about the asterisk-users mailing list