1,575
edits
Changes
no edit summary
=Install UMS=
#Install the necessary packages##run ''by running the following commands <pre>sudo apt-get install software-properties-common''#&#run ''10;sudo apt-get update''&##run ''10;sudo apt-get install openjdk-8-jre openjdk-8-jre-headless''#&#run ''10;apt-get install mediainfo dcraw vlc-bin mplayer mencoder''</pre>#Install UMS 8.0.1 by running the latest version of UMS##run ''following commands <pre>cd /opt''&##run ''10;sudo wget https://downloads.sourceforge.net/project/unimediaserver/Official%20Releases/Linux/UMS-8.0.1.tgz''#&#run ''10;sudo tar -xvzf UMS-8.0.1.tgz''&##run ''10;sudo ln -s /opt/ums-8.0.1 ums''&##run ''10;sudo rm UMS-8.0.1.tgz''</pre>
#Setup UMS to auto start at boot
##run ''Create an init.d script by running <pre>sudo nano /etc/init.d/ums'' </pre> and copy copying the following into that file. <nowikipre>#!/bin/bash # ### BEGIN INIT INFO # Provides: ums # Required-Start: $local_fs $remote_fs $network # Required-Stop: $local_fs $remote_fs $network # Default-Start: 2 3 4 5 # Default-Stop: 0 1 6 # Short-Description: Starts UMS program. # Description: Java Upnp Media Server dedicated to PS3 ### END INIT INFO #set -x # Author: Papa Issa DIAKHATE <paissad@gmail.com> # PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin DESC="Universal Media Server" NAME=ums UMS_PROFILE=/etc/UMS.conf DAEMON=/opt/ums/UMS.sh DAEMON_OPTS="console" SCRIPTNAME=/etc/init.d/ums UMS_START=1 # Wether to start or not UMS ver at boot time. DODTIME=30 # Time to wait for the server to die, in seconds. # If this value is set too low you might not # let the program to die gracefully and 'restart' will not work test -x $DAEMON || exit 1 # Load the VERBOSE setting and other rcS variables . /lib/init/vars.sh # Define LSB log_* functions. # Depend on lsb-base (>= 3.0-6) to ensure that this file is present. . /lib/lsb/init-functions # Include ums defaults if available if [ -f "/etc/default/$NAME" ] ; then . /etc/default/$NAME fi &# May 10; # May we run the init.d script ? [ $UMS_START = 1 ] || exit 1 #-------------------------------------------------------------------------- # Some color codes txtred=$'\e[0;31m' # Red txtylw=$'\e[0;33m' # Yellow txtrst=$'\e[0m' # Text Reset #-------------------------------------------------------------------------- warnout(){ echo >&2 -e ""$txtylw"Warning:$txtrst $1" } #-------------------------------------------------------------------------- running(){ pid=`pgrep -f 'java .*ums.jar.*'` } #-------------------------------------------------------------------------- do_start(){ running && { warnout "$NAME is already running !"; exit 0; } echo "Starting $DESC : $NAME" UMS_PROFILE="$UMS_PROFILE" start-stop-daemon --start --quiet --background --oknodo \ --exec $DAEMON -- $DAEMON_OPTS } #-------------------------------------------------------------------------- do_stop(){ running || { warnout "$NAME is NOT running !"; exit 0; } local countdown="$DODTIME" echo -e "Stopping $DESC : $NAME \c " kill -9 $pid while running; do if (($countdown >= 0)); then sleep 1; echo -n .; ((--countdown)) else break; fi done echo # If still running, then try to send SIGINT signal running && { \ echo >&2 "Using kill -s SIGINT instead"; \ echo >&2 "If you see this message again, then you should increase the value of DODTIME in '$0'."; \ kill -2 $pid; \ } if [ -e "/usr/share/ums/debug.log" ]; then count=9 while [ $count -ge 1 ] do if [ -e "/usr/share/ums/debug.log.$count" ]; then plus=$((count+1)) mv "/usr/share/ums/debug.log.$count" "/usr/share/ums/debug.log.$plus" fi count=$((count-1)) done if [ -e "/usr/share/ums/debug.log" ]; then mv "/usr/share/ums/debug.log" "/usr/share/ums/debug.log.1" fi fi return 0} return 0 } #-------------------------------------------------------------------------- do_force-stop(){ running || { warnout "$NAME is NOT running !"; exit 0; } echo "Stopping $DESC : $NAME" kill -9 $pid if [ -e "/usr/share/ums/debug.log" ]; then count=9 while [ $count -ge 1 ] do if [ -e "/usr/share/ums/debug.log.$count" ]; then plus=$((count+1)) mv "/usr/share/ums/debug.log.$count" "/usr/share/ums/debug.log.$plus" fi count=$((count-1)) done if [ -e "/usr/share/ums/debug.log" ]; then mv "/usr/share/ums/debug.log" "/usr/share/ums/debug.log.1" fi fi } #-------------------------------------------------------------------------- do_status(){ echo -n " * $NAME is " ( running || { echo "NOT running "; exit 0; } ) ( running && { echo "running (PID -> $(echo $pid))"; exit 0; } ) } #-------------------------------------------------------------------------- case "$1" in start|stop|force-stop|status) do_${1} ;; restart|reload) do_stop do_start ;; force-restart|force-reload) do_force-stop do_start ;; *) echo "Usage: $SCRIPTNAME {start|stop|force-stop|restart|force-restart|reload|force-reload|status}" exit 1 ;; esac</nowikipre>##run ''Make that script executable by running <pre>chmod +x /etc/init.d/ums''</pre>##run ''Make the system aware of your new script by running <pre>update-rc.d ums defaults''</pre>
#Configure UMS
##run Copy the default configuration files to ''/etc/''by running the following commands <pre>sudo cp /opt/ums/UMS.conf /etc/''&##run ''10;sudo cp /opt/ums/WEB.conf /etc/ums/''</pre>##run Edit ''UMS.conf''by running <pre>sudo nano /etc/UMS.conf'' </pre> and set setting the following variables (you'll have to setup ''folders'' and ''folders_monitored'' to something specific for your environment)##*<pre>server_name = MyMediaServer#&#*10;language = en-US&##*10;minimized = true&##*10;auto_update = true#&#*10;hide_advanced_options = false&##*10;single_instance = true&##*10;chromecast_extension = true&##*10;prettify_filenames = true&##*10;show_server_settings_folder = true&##*10;atz_limit = 3000#&#*10;show_recently_played_folder = true&##*10;folders = /mnt/media/Video/Movies, /mnt/media/Video/TV_Shows, /mnt/media/Video/Web_Shows, /mnt/media/Music, /mnt/media/Comedy&##*10;folders_monitored = /mnt/media/Video/Movies, /mnt/media/Video/TV_Shows, /mnt/media/Video/Web_Shows, /mnt/media/Music, /mnt/media/Comedy&##*10;web_port = 80&##*10;web_conf = /etc/ums/WEB.conf#&#*10;name = main</pre>=Start UMS=#start UMS by running ''<pre>sudo service ums start''</pre>
#visit the UMS webpage by going to ''http://<UMSServerHostname>'' in a web browser