Well.
Hi everybody again.
I have a trouble with some script that I wanna to be executed as a Service in an Ubuntu Server 10.04 LTS PC. This is the script:
#! /bin/sh
JBOSS_BIN=/usr/local/jboss/bin
JBOSS_START_SCRIPT=$JBOSS_BIN/run.sh
JBOSS_STOP_SCRIPT=/usr/local/jboss/bin/shutdown.sh
J开发者_JS百科BOSS_BIND_ADDR=${JBOSS_HOST:-"-b 0.0.0.0"}
ECHO=/bin/echo
TEST=/usr/bin/test
$TEST -x $JBOSS_START_SCRIPT || exit 0
$TEST -x $JBOSS_STOP_SCRIPT || exit 0
start(){
$ECHO "Starting JBoss"
su - jboss -c $JBOSS_START_SCRIPT $JBOSS_BIND_ADDR "> /dev/null &"
$ECHO "."
}
stop(){
$ECHO "Stopping JBoss"
su - jboss -c $JBOSS_STOP_SCRIPT -S
$ECHO "."
}
case "$1" in
start)
start
;;
stop)
stop
;;
restart)
stop
sleep 30
start
;;
*)
$ECHO "Usage: jboss (start|stop|restart)"
exit 1
;;
esac
exit 0
Well That script is not working because I don't know exactly how to put "> /dev/null &" for being executed correctly. See, if I do the command in a hand in the gnome-terminal it works, but when I write it in the script and execute it, it fails. So I don't know what is working wrong. Perhaps some buggy syntax? plz help me; I'm really stuck with this.
Leave off the quotes that you have around > /dev/null &
su - jboss -c $JBOSS_START_SCRIPT $JBOSS_BIND_ADDR > /dev/null &
精彩评论