%20en%20Ubuntu%2014.04%20no%20lee%20el%20archivo%20de%20configuraci%C3%B3n.png)
Estoy intentando que mi ubuntu 14.04 ejecute un servidor multimedia universal para poder transmitir películas a mi ps3 (desafortunadamente, el firmware más bajo, 4.55, no se puede romper).
Después de mucha investigación en la red, pude ejecutarlo como un servicio, /etc/init.d/UMS.sh
los otros archivos están en /usr/ums
la carpeta. Estos incluyen el UMS.conf
archivo de configuración, UMS.sh
el archivo y ums.jar
el archivo y todos los demás.
He usado cream
( gedit
tiene problemas con la creación de estos archivos temporales que necesito eliminar más adelante) para editar UMS.conf
el archivo.
Estoy intentando que se ejecute en un puerto específico y tenga una lista blanca de IP para que nadie en la red pueda acceder a mis cosas.
Así que hice los cambios en UMS.conf
el archivo, lo cargué varias veces para verificar que los cambios se guardaron (lo hicieron), pero cuando lo hago:
service UMS.sh start
UMS se iniciará pero con todas las configuraciones predeterminadas.
Por favor ayuda. Soy nuevo en Ubuntu, así que guíenme. Puedo proporcionar el script /etc/init.d/UMS.sh
si eso ayuda, pero dígame cómo pegarlo aquí. Lo intenté y el # puso las cosas en negrita.
ACTUALIZACIÓN: Con la ayuda del comentario de Letizia, aquí está el guión de
'/etc/init.d/UMS.sh'
#!/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 <[email protected]>
#
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
DESC="Universal Media Server"
NAME=UMS.sh
UMS_PROFILE=/etc/$NAME
DAEMON=/usr/ums/$NAME
DAEMON_OPTS="console"
SCRIPTNAME=/etc/init.d/$NAME
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 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
}
#--------------------------------------------------------------------------
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
Respuesta1
Parece que usaste el mismo script que yo usé para instalar UMS. Me encontré con el mismo problema y encontré una manera de solucionarlo. El script crea un vínculo en /etc que apunta a un archivo en /root que no existe. Si haces un ls -l en /etc deberías ver algo como:
UMS.sh < /root/.config/UMS.conf
pero el script nunca crea ese archivo, probablemente tampoco tenga los permisos. Entonces lo que hice fue eliminar ese enlace y crear uno nuevo que apunte al archivo de configuración en /usr/ums/
sudo rm /etc/UMS.sh
sudo ln -s /usr/ums/UMS.conf /etc/UMS.sh
Esto terminó funcionando para mí y ahora puedo editar el archivo UMS.conf para realizar cambios. Espero que esto ayude.
Respuesta2
No, la solución correcta es esta:
- ejecute UMS.sh como root; creará el perfil /root/.config/UMS
- edite el script de inicio /etc/init.d/ums y coloque la ruta del perfil correctamente: UMS_PROFILE=/root/.config/UMS/