Sono riuscito a farlo partire al boot della macchina ma quando dovrebbe visualizzare la gui mi da un errore:
Can't connect to X11 window server using ':0.0' as the value of the DISPLAY variable.
Su google ho trovato questo link Re: [xfree] eseguire demone con GUI, ma purtroppo non mi funziona ( probabilmente sbaglio io ),
premetto che se lancio lo script funziona, mentre lanciando
- Codice: Seleziona tutto
service registro start
Mi sapete aiutare
Lo script che utilizzo è questo:
- Codice: Seleziona tutto
#!/bin/sh
#
# init.d/registro {start|stop|restart|status}
#
# JAVA_HOME Must point at your Java Development Kit installation.
#
# TOMCAT_COMMON Must point at your Tomcat common lib folder.
#
# A function to find the pid of a program.
pidofproc() {
base=${1##*/}
# Test syntax.
if [ "$#" = 0 ]; then
echo $"Usage: pidofproc {program}"
return 1
fi
# First try "/var/run/*.pid" files
if [ -f /var/run/$base.pid ]; then
local line p pid=
read line < /var/run/$base.pid
for p in $line ; do
[ -z "${p//[0-9]/}" -a -d /proc/$p ] && pid="$pid $p"
done
if [ -n "$pid" ]; then
echo $pid
return 0
fi
fi
pidof -o $$ -o $PPID -o %PPID -x $1 || \
pidof -o $$ -o $PPID -o %PPID -x $base
}
status() {
local base=${1##*/}
local pid
# Test syntax.
if [ "$#" = 0 ] ; then
echo $"Usage: status {program}"
return 1
fi
# First try "pidof"
pid=`pidof -o $$ -o $PPID -o %PPID -x java || \
pidof -o $$ -o $PPID -o %PPID -x java`
if [ -f /var/run/${base}.pid ] ; then
read pidfile < /var/run/${base}.pid
if [ "$pid"=="$pidfile" ]; then
echo $"${base} (pid $pidfile) is running..."
return 0
fi
fi
# Next try "/var/run/*.pid" files
if [ -f /var/run/${base}.pid ] ; then
read pid < /var/run/${base}.pid
if [ -n "$pid" ]; then
echo $"${base} dead but pid file exists"
return 1
fi
fi
# See if /var/lock/subsys/${base} exists
if [ -f /var/lock/subsys/${base} ]; then
echo $"${base} dead but subsys locked"
return 2
fi
echo $"${base} is stopped"
return 3
}
PRG="$0"
MYJAVA_HOME=/usr/java/j2sdk1.4.2_04/bin
TOMCAT_COMMON="/usr/local/jakarta-tomcat/common"
REGISTRO_HOME="/usr/local/registro"
EXECUTABLE="$MYJAVA_HOME"/java
#Avvia il processo
start(){
CONFIG_FILE="$REGISTRO_HOME/configuration.properties"
JAR_OBJ =registro.jar
OPTION=-Ddburl=.....
GO="$EXECUTABLE "$OPTION"
$GO -start &
echo $! > /var/run/registro.pid
}
stop(){
STOP_EX="$EXECUTABLE $JAR_OBJ -stop"
$STOP_EX &
rm /var/run/registro.pid
}
# Analisi dell'argomento usato nella chiamata.
case "$1" in
start)
echo "Avvio del servizio Registro Protocollo:"
start
echo
;;
stop)
echo "Disattivazione del servizio Registro Protocollo: "
stop
echo
;;
restart)
stop
echo
start
;;
status)
status registro
RETVAL=$?
;;
*)
echo "Utilizzo: Registro {start|stop|restart|status}"
exit 1
esac
exit 0