While twonkymedia.sh included in the manual install tarball for linux works, I have started using the attached init script instead (mainly because I find it easier to read, if you are happy with twonkymedia.sh there is no need to use this)
If you do use it, please provide feedback (both positive and negative) in this topic.
RHEL 5 / CentOS 5 init script for TMS 5
- Attachments
-
- TwonkyMediaServer.txt
- the .txt extension is only to override "The extension is not allowed." of the forum software
copy the file to /etc/init.d/TwonkyMediaServer (dropping the .txt)
chkconfig --add TwonkyMediaServer
chkconfig TwonkyMediaServer on - (2.32KiB)Downloaded 410 times
-
- Posts:75
- Joined:Tue Sep 05, 2006 7:12 am
- AV Hardware:ClearOS 5.1 Linux server (4.4.18)
ClearOS 5.1 Linux server (5.1.3)
PS3
HDX-HD1000 - Location:Stockholm, Sweden
- Contact:
Re: RHEL 5 / CentOS 5 init script for TMS 5
Hi,
Excellent script! It's way clearer than the cluttered one i used to use. I did some modifications and removed the reload option since it doesn't work on my ClearOS install.
In order to get transcoding with ffmpeg you can't use the -D flag!
I ended up with this:
Excellent script! It's way clearer than the cluttered one i used to use. I did some modifications and removed the reload option since it doesn't work on my ClearOS install.
In order to get transcoding with ffmpeg you can't use the -D flag!
I ended up with this:
Code: Select all
#!/bin/bash
#
# turn on debug mode
#set -x
#
# /etc/rc.d/init.d/twonkymedia
#
# based on the acpid sysvinit file
# and twonkymedia.sh
# pcfe, 2010-02-21
#
# Starts the TwonkyMediaServer daemons
#
# chkconfig: 2345 99 99
# description: TwonkyMedia UPnP server
# processname: twonkymedia
# processname: twonkymediaserver
### BEGIN INIT INFO
# Provides: twonkyserver
# Required-Start: $network $remote_fs
# Default-Start: 3 5
# Default-Stop: 0 1 2 6
# Description: TwonkyMedia UPnP server
### END INIT INFO
#==================================================================[ Setup ]===
TVMSHOME="/opt/TwonkyMedia"
TVMSLOGHOME="/var/log"
TVMSLOGFILE="$TVMSLOGHOME/twonkymedia.log"
TVMSINI="$TVMSHOME/twonkyvision-mediaserver.ini"
TVMUSER="twonkymedia"
TVMSIP="192.168.2.1"
DAEMON="twonkymedia"
TVMSBIN="$TVMSHOME/$DAEMON"
# Source function library.
. /etc/rc.d/init.d/functions
# read configuration settings TwonkyMediaServer, if present.
# example of the file
TMSOPTIONS=" -logfile $TVMSLOGFILE -inifile $TVMSINI"
if [ -f /etc/sysconfig/twonkymedia ]; then
. /etc/sysconfig/twonkymedia
fi
RETVAL=0
check() {
# Check that we're a privileged user
[ $(id -u) = 0 ] || exit 4
# Check if TVMSHOME exists
test -d "$TVMSHOME" || exit 5
# Check if TVMSLOGHOME exists
test -d "$TVMSLOGHOME" || exit 5
# Check if twonkymedia is executable
test -x "$TVMSBIN" || exit 5
}
start() {
check
echo -n $"Starting TwonkyMediaServer daemon: "
daemon --user $TVMUSER "$TVMSBIN $TMSOPTIONS" 2>&1 >> $TVMSLOGFILE
RETVAL=$?
if [ $RETVAL -eq 0 ]; then
touch /var/lock/subsys/twonkymedia
echo_success
else
echo_failure
fi
echo
return $RETVAL
}
stop() {
check
echo -n $"Stopping TwonkyMediaServer daemon: "
killproc "$TVMSBIN"
RETVAL=$?
[ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/twonkymedia
echo
return $RETVAL
}
restart() {
stop
start
}
case "$1" in
start)
start
;;
stop)
stop
;;
force-reload)
restart
;;
restart)
restart
;;
condrestart)
if [ -f /var/lock/subsys/twonkymedia ]; then
restart
fi
;;
status)
status twonkymedia
status twonkymediaserver
;;
*)
echo $"Usage: $0 {start|stop|status|restart|condrestart|force-reload}"
RETVAL=2
esac
exit $RETVAL