HI,
der lsof |grep asterisk |grep /dev/ bringt folgende Ausgaben:
Asterisk als root:
asterisk 4770 root 0u CHR 136,0 2 /dev/pts/0
asterisk 4770 root 1u CHR 136,0 2 /dev/pts/0
asterisk 4770 root 2u CHR 136,0 2 /dev/pts/0
asterisk 4770 root 8u CHR 46,0 115953 /dev/mISDN
Asterisk als asterisk:
asterisk 4857 asterisk 0u CHR 1,3 114493 /dev/null
asterisk 4857 asterisk 1u CHR 1,3 114493 /dev/null
asterisk 4857 asterisk 2u CHR 1,3 114493 /dev/null
asterisk 4857 asterisk 8u CHR 46,0 115953 /dev/mISDN
mpg123 4861 asterisk 0u CHR 1,3 114493 /dev/null
mpg123 4861 asterisk 2u CHR 1,3 114493 /dev/null
Code:
Hier das init.d Script:
#! /bin/sh
#
# asterisk start the asterisk PBX
# (c) Mark Purcell <[email protected]>
# May be distributed under the terms of this General Public License
#
# Based on:
#
# skeleton example file to build /etc/init.d/ scripts.
# This file should be used to construct scripts for /etc/init.d.
#
# Written by Miquel van Smoorenburg <[email protected]>.
# Modified for Debian GNU/Linux
# by Ian Murdock <[email protected]>.
#
# Version: @(#)skeleton 1.9 26-Feb-2001 [email][email protected][/email]
#
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
NAME=asterisk
USER=$NAME
DESC="Asterisk PBX"
PIDFILE="/var/run/asterisk/asterisk.pid"
# by default: use real-time priority
PARAMS=""
AST_REALTIME="yes"
RUNASTERISK="no"
MODULEINIT=""
if [ -r /etc/default/asterisk ]; then . /etc/default/asterisk; fi
if [ "$RUNASTERISK" != "yes" ];then
echo "Asterisk not yet configured. Edit /etc/default/asterisk first."
exit 1
fi
if [ "$AST_REALTIME" != "no" ]
then
PARAMS="$PARAMS -p"
fi
if [ "x$USER" = "x" ]
then
echo "Error: empty USER name"
exit 1
fi
if [ `id -u "$USER"` = 0 ]
then
echo "Starting as root not supported."
exit 1
fi
PARAMS="$PARAMS -U $USER"
if [ "x$RUNASTSAFE" = "xyes" ];then
DAEMON=/usr/sbin/safe_asterisk
REALDAEMON=/usr/sbin/asterisk
else
DAEMON=/usr/sbin/asterisk
fi
test -x $DAEMON || exit 0
set -e
case "$1" in
start)
echo -n "Starting $DESC: "
start-stop-daemon --start --pidfile "$PIDFILE" --exec $DAEMON -- $PARAMS
echo "$NAME."
;;
stop)
echo -n "Stopping $DESC: "
if [ "$RUNASTSAFE" = "yes" ];then
# hopefully this will work. Untested
$REALDAEMON -rx 'stop now' > /dev/null || true
else
# Try gracefully
$DAEMON -rx 'stop now' > /dev/null 2>&1 || true
fi
echo -n "$NAME"
# giving a small grace time to shut down cleanly.
sleep 2
if [ "$RUNASTSAFE" = "yes" ];then
start-stop-daemon --quiet --oknodo --stop --exec $DAEMON
fi
# just making sure it's really, really dead.
# KILL is necessary just in case there's an asterisk -r in the background
start-stop-daemon --stop --quiet --oknodo --retry=0/2/TERM/2/KILL/5 --exec $DAEMON
echo "."
;;
reload)
echo "Reloading $DESC configuration files."
$DAEMON -rx 'reload'
;;
logger-reload)
$DAEMON -rx 'logger reload'
;;
extensions-reload)
echo "Reloading $DESC configuration files."
$DAEMON -rx 'extensions reload'
;;
restart|force-reload)
$0 stop
$0 start
;;
*)
N=/etc/init.d/$NAME
# echo "Usage: $N {start|stop|restart|reload|logger-reload|extensions-reload|force-reload}" >&2
echo "Usage: $N {start|stop|restart|force-reload}" >&2
exit 1
;;
esac
exit 0