S90mediatomb:
Code:
#!/bin/sh
# mediatomb This script starts and stops the mediatomb daemon
#
# chkconfig: - 95 30
# processname: mediatomb
# description: mediatomb is a daemon process which provides a UPnP service
# Set the absolute path to mediatomb
LAUNCHDIR="/opt/etc/mediatomb"
# By default it's all good
RETVAL=0
# See how we were called.
case "$1" in
start)
# Check if MT is already running
if [ -e /opt/var/lock/mediatomb ] ; then
$0 stop
fi
# Start daemon.
export MEDIATOMB_DATADIR="$LAUNCHDIR/usr/share/mediatomb"
export MEDIATOMB_MAGIC_FILE="usr/share/file/magic"
$LAUNCHDIR/usr/bin/mediatomb -d -m $LAUNCHDIR -f config
echo -n "Starting mediatomb: "
RETVAL=$?
if [ $RETVAL = 0 ] ; then
touch /opt/var/lock/mediatomb
echo "ok"
else
echo "failed"
fi
;;
stop)
# Stop daemons.
echo -n "Shutting down mediatomb: "
killall mediatomb 2>/dev/null
RETVAL=$?
if [ $RETVAL = 0 ] ; then
rm -f /opt/var/lock/mediatomb
echo "ok"
else
echo "failed"
fi
;;
restart)
$0 stop
$0 start
;;
condrestart)
[ -e /opt/var/lock/mediatomb ] && $0 restart
;;
*)
$0 start
;;
esac
exit $RETVAL
Set the absolute path to MediaTomb in S90mediatomb, place script in /opt/etc/init.d, and chmod 0755
In Tomato, go to USB and NAS > USB Support
Add the following to Run after mounting:
Code:
#OptWare Startup
if [ -d /opt/etc/init.d ]; then
for f in /opt/etc/init.d/S* ; do
[ -x $f ] && $f start
done
fi
Add the following to Run before unmounting:
Code:
#OptWare Stop
if [ -d /opt/etc/init.d ]; then
for f in /opt/etc/init.d/S* ; do
[ -x $f ] && $f stop
done
fi
Now, MediaTomb static, and any other Optware you decide to install, should start automatically.