diff options
author | Willer Moreira <willer.moreira@openbossa.org> | 2010-02-02 16:10:34 -0400 |
---|---|---|
committer | Khem Raj <raj.khem@gmail.com> | 2010-08-27 15:41:23 -0700 |
commit | 8d6832e3fba63e86e047932d1a2de20b60654254 (patch) | |
tree | 31bf0a4339fe6cec02d581cc11a5c1f60ba6aca9 /recipes/dspgw-utils/files/dsp | |
parent | 510367b6ca14dc89a9669a8938a7d177ff4bb02d (diff) | |
download | openembedded-8d6832e3fba63e86e047932d1a2de20b60654254.tar.gz |
dspgw-utils: Adding DSP Gateway Utilities package
Signed-off-by: Rodrigo Vivi <rodrigo.vivi@openbossa.org>
Signed-off-by: Francisco Alecrim <francisco.alecrim@openbossa.org>
Signed-off-by: Willer Moreira <willer.moreira@openbossa.org>
Diffstat (limited to 'recipes/dspgw-utils/files/dsp')
-rw-r--r-- | recipes/dspgw-utils/files/dsp | 96 |
1 files changed, 96 insertions, 0 deletions
diff --git a/recipes/dspgw-utils/files/dsp b/recipes/dspgw-utils/files/dsp new file mode 100644 index 0000000000..4387d60472 --- /dev/null +++ b/recipes/dspgw-utils/files/dsp @@ -0,0 +1,96 @@ +#!/bin/sh +# DSP Gateway init script +# Copyright (C) 2007 INdT. +# @author Abner Jose de Faria Silva <abner.silva@indt.org.br> +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +set -e + +DESC="DSP Gateway" + +DAEMON=/usr/sbin/dsp_dld +DSPCTL=/usr/sbin/dspctl +DSPCONF=/lib/dsp/dsp_dld_avs.conf + +DAEMONPARAM="-p --disable-restart -c $DSPCONF" + +KMEMRESERVE=360000 + +PIDDIR=/var/run/dsp +PIDFILE=$PIDDIR/pid + +test -x "$DAEMON" || exit 0 +test -x "$DSPCTL" || exit 0 +test -e "$DSPCONF" || exit 0 + +start_dsp() +{ + if [ ! -d "$PIDDIR" ]; then + mkdir -p "$PIDDIR" + fi + + if [ -e "$PIDFILE" ]; then + TMP=/proc/$(cat $PIDFILE) + if [ -d "$TMP" -a "$(readlink -f $TMP/exe)" = "$DAEMON" ]; then + echo "$DESC is already running." + return + else + echo "Removing old PID file $PIDFILE." + rm -f "$PIDFILE" + fi + fi + + echo -n "Starting $DESC: " + + $DSPCTL kmem_reserve $KMEMRESERVE + start-stop-daemon --start --quiet -b --make-pidfile --pidfile "$PIDFILE" \ + --exec "$DAEMON" -- $DAEMONPARAM + + echo "done." +} + +stop_dsp() +{ + echo -n "Stopping $DESC: " + + $DSPCTL kmem_release + start-stop-daemon --stop --quiet --name $(basename "$DAEMON") \ + --pidfile "$PIDFILE" + rm -f "$PIDFILE" + + echo "done." +} + +case "$1" in + start) + start_dsp + ;; + stop) + stop_dsp + ;; + restart|force-reload) + stop_dsp + start_dsp + ;; + *) + echo "Usage: $(basename $0) {start|stop|restart|force-reload}" >&2 + exit 1 + ;; +esac + +echo "" + +exit 0 |