Hallo, ich habe asterisk 1.4.5 auf einem Centos 4.5 mit der Beronet 4S0 und misdn 1.1.5
am laufen.
Nun wollte ich Asterisk über ein Script in /etc/init.d als Service laufen lassen was auch zu
funktionieren scheint nur, dass er misdn nicht initialisieren kann.
Dies ist das Einzige, was isch in den Logfiles gefunden habe:
ERROR[28147] chan_misdn.c: Unable to initialize mISDN
Wenn ich asterisk normal starte, funktioniert es sofort wieder.
Die einzigen Unterschiede scheinen zu sein:
1. asterisk läuft nicht mehr mit root Rechten
2. Anstatt mit asterisk wird asterisk mit safe_asterisk gestartet.
betr. Rechte:
Hier habe ich etwas basteln müssen z.B. die Verzeichnis-Rechte der VoiceBox ändern
und astrundir nach /var/run/asterisk legen.
Hab ich da was vergessen ?
Hier noch das init script:
#!/bin/sh
# Use this option to specify a different configuration directory
#AST_CONFIG=/etc/asterisk
# Installation directory
AST_SBIN=/usr/sbin
# Uncomment the following and set them to the user/groups that you
# want to run Asterisk as. NOTE: this requires substantial work to
# be sure that Asterisk's environment has permission to write the
# files required for its operation, including logs, its comm
# socket, the asterisk database, etc.
AST_USER="asterisk"
AST_GROUP="asterisk"
# Source function library.
. /etc/rc.d/init.d/functions
if ! [ -x $AST_SBIN/asterisk ] ; then
echo "ERROR: $AST_SBIN/asterisk not found"
exit 0
fi
if ! [ -d $AST_CONFIG ] ; then
echo "ERROR: $AST_CONFIG directory not found"
exit 0
fi
# Uncomment this ONLY if you know what you are doing.
# export LD_ASSUME_KERNEL=2.4.1
# Full path to asterisk binary
DAEMON=$AST_SBIN/asterisk
# Full path to safe_asterisk script
SAFE_ASTERISK=$AST_SBIN/safe_asterisk
# Allow configuration overrides in /etc/sysconfig/asterisk
CONFIG0=`readlink $0`
if [ "$CONFIG0" = "" ]; then
CONFIGFILE=/etc/sysconfig/`basename $0`
else
CONFIGFILE=/etc/sysconfig/`basename $CONFIG0`
fi
[ -x $CONFIGFILE ] && . $CONFIGFILE
RETVAL=0
start() {
# Start daemons.
echo -n $"Starting asterisk: "
if [ -f $SAFE_ASTERISK ] ; then
DAEMON=$SAFE_ASTERISK
fi
if [ $AST_USER ] ; then
ASTARGS="-U $AST_USER"
fi
if [ $AST_GROUP ] ; then
ASTARGS="$ASTARGS -G $AST_GROUP"
fi
if [ $AST_CONFIG ]; then
ASTARGS="$ASTARGS -C $AST_CONFIG"
fi
daemon $DAEMON $ASTARGS
RETVAL=$?
[ $RETVAL -eq 0 ] && touch /var/lock/subsys/asterisk
echo
return $RETVAL
}
stop() {
# Stop daemons.
echo -n $"Shutting down asterisk: "
for i in `ps -f -u asterisk | grep [m]pg123 | awk '{ print $2 }'`; do
kill -9 $i
done
killproc asterisk
RETVAL=$?
[ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/asterisk
echo
return $RETVAL
}
restart() {
stop
start
}
reload() {
$DAEMON -rx 'reload' > /dev/null 2> /dev/null
}
# See how we were called.
case "$1" in
start)
start
;;
stop)
stop
;;
restart)
restart
;;
reload)
reload
;;
condrestart)
[ -f /var/lock/subsys/asterisk ] && restart || :
;;
status)
status asterisk
;;
*)
echo "Usage: asterisk {start|stop|restart|reload|condrestart|status}"
exit 1
esac
exit $?
Merci im Voraus
am laufen.
Nun wollte ich Asterisk über ein Script in /etc/init.d als Service laufen lassen was auch zu
funktionieren scheint nur, dass er misdn nicht initialisieren kann.
Dies ist das Einzige, was isch in den Logfiles gefunden habe:
ERROR[28147] chan_misdn.c: Unable to initialize mISDN
Wenn ich asterisk normal starte, funktioniert es sofort wieder.
Die einzigen Unterschiede scheinen zu sein:
1. asterisk läuft nicht mehr mit root Rechten
2. Anstatt mit asterisk wird asterisk mit safe_asterisk gestartet.
betr. Rechte:
Hier habe ich etwas basteln müssen z.B. die Verzeichnis-Rechte der VoiceBox ändern
und astrundir nach /var/run/asterisk legen.
Hab ich da was vergessen ?
Hier noch das init script:
#!/bin/sh
# Use this option to specify a different configuration directory
#AST_CONFIG=/etc/asterisk
# Installation directory
AST_SBIN=/usr/sbin
# Uncomment the following and set them to the user/groups that you
# want to run Asterisk as. NOTE: this requires substantial work to
# be sure that Asterisk's environment has permission to write the
# files required for its operation, including logs, its comm
# socket, the asterisk database, etc.
AST_USER="asterisk"
AST_GROUP="asterisk"
# Source function library.
. /etc/rc.d/init.d/functions
if ! [ -x $AST_SBIN/asterisk ] ; then
echo "ERROR: $AST_SBIN/asterisk not found"
exit 0
fi
if ! [ -d $AST_CONFIG ] ; then
echo "ERROR: $AST_CONFIG directory not found"
exit 0
fi
# Uncomment this ONLY if you know what you are doing.
# export LD_ASSUME_KERNEL=2.4.1
# Full path to asterisk binary
DAEMON=$AST_SBIN/asterisk
# Full path to safe_asterisk script
SAFE_ASTERISK=$AST_SBIN/safe_asterisk
# Allow configuration overrides in /etc/sysconfig/asterisk
CONFIG0=`readlink $0`
if [ "$CONFIG0" = "" ]; then
CONFIGFILE=/etc/sysconfig/`basename $0`
else
CONFIGFILE=/etc/sysconfig/`basename $CONFIG0`
fi
[ -x $CONFIGFILE ] && . $CONFIGFILE
RETVAL=0
start() {
# Start daemons.
echo -n $"Starting asterisk: "
if [ -f $SAFE_ASTERISK ] ; then
DAEMON=$SAFE_ASTERISK
fi
if [ $AST_USER ] ; then
ASTARGS="-U $AST_USER"
fi
if [ $AST_GROUP ] ; then
ASTARGS="$ASTARGS -G $AST_GROUP"
fi
if [ $AST_CONFIG ]; then
ASTARGS="$ASTARGS -C $AST_CONFIG"
fi
daemon $DAEMON $ASTARGS
RETVAL=$?
[ $RETVAL -eq 0 ] && touch /var/lock/subsys/asterisk
echo
return $RETVAL
}
stop() {
# Stop daemons.
echo -n $"Shutting down asterisk: "
for i in `ps -f -u asterisk | grep [m]pg123 | awk '{ print $2 }'`; do
kill -9 $i
done
killproc asterisk
RETVAL=$?
[ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/asterisk
echo
return $RETVAL
}
restart() {
stop
start
}
reload() {
$DAEMON -rx 'reload' > /dev/null 2> /dev/null
}
# See how we were called.
case "$1" in
start)
start
;;
stop)
stop
;;
restart)
restart
;;
reload)
reload
;;
condrestart)
[ -f /var/lock/subsys/asterisk ] && restart || :
;;
status)
status asterisk
;;
*)
echo "Usage: asterisk {start|stop|restart|reload|condrestart|status}"
exit 1
esac
exit $?
Merci im Voraus