#! /bin/sh#### BEGIN INIT INFO# Provides: metalayer-crawler0# Required-Start: $syslog# Required-Stop: $syslog# Should-Start: $local_fs# Should-Stop: $local_fs# Default-Start: 2 3 4 5# Default-Stop: 1 6# Short-Description: metalayer crawler# Description: Metalayer Crawler part of the Mediaplayer suite.### END INIT INFO## Startup script for Metalayer CrawlerPATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/binDAEMON=/usr/bin/metalayer-crawlerNAME=metalayer-crawler0DESC="Metalayer Crawler"INITFILE=/etc/init.d/$NAMEMEDIAPATH=/home/user/MyDocs/.video,/home/user/MyDocs/.sounds,/home/user/MyDocs/.images,/media/mmc1/mp3,/media/mmc1/podcast,/media/mmc1/video,/media/mmc2/mp3,/media/mmc2/videoset -e# abort if no executable existstest -x $DAEMON || exit 0# When inside scratchbox we are not really root nor do we have 'user' userif [ ! -f /targets/links/scratchbox.config ]; then USER=user HOME=/home/$USER if [ `id -u` = 0 ]; then CHUID="--chuid $USER" NICE="--nice=19" fifi# All dsmetool invocations have crawler's -F (foreground) flag set.# Although this should not be required for stop, dsmetool wants to stop# the process with its exact name, and we are using "$DAEMON -F" as the# command to execute. This prevents upgrade errors and keeps the output# always clean.case "$1" in start) printf "Starting $DESC: $NAME" dsmetool -f "$DAEMON -F -c $MEDIAPATH" $NICE -U $USER printf ".\n" ;; stop) printf "Stopping: $DESC: $NAME" dsmetool -k "$DAEMON -F -c $MEDIAPATH" printf ".\n" ;; restart|force-reload) printf "Restarting $DESC: $NAME" dsmetool -k "$DAEMON -F -c $MEDIAPATH" sleep 1 dsmetool -f "$DAEMON -F -c $MEDIAPATH" $NICE -U $USER printf ".\n" ;; *) N=/etc/init.d/$NAME echo "Usage: $N {start|stop|restart|force-reload}" >&2 exit 1 ;;esacexit 0