I have a java jar that runs as a socketserver on each cluster webserver. There is a controller that talks to these to keep file system in sync. The problem I have run into is when the SocketServer is started via service servermngr start or chkconfig on boot the Java exec() command doesnt seem to interact with CentOS. It responds to status requests and accepts commands but the commands dont get executed
If I login via ssh and issue /etc/init.d/servermngr start and then logout. It runs perfectly until the server reboots.
Here is the startscript
Code:
#!/bin/sh
# chkconfig: 2345 95 1
# description: Starts Daemon Using ServerManager.jar.
#
# Source function library.
. /etc/init.d/functions
start () {
echo -n $"Starting ServerManager: "
# start daemon
cd /www/servermanager/
daemon java -jar ServerManager.jar > /www/logs/ServerManager.log &
RETVAL=$?
echo
[ $RETVAL = 0 ] && touch /var/lock/subsys/cups
echo "";
return $RETVAL
}
stop () {
# stop daemon
echo -n $"Stopping $prog: "
kill `ps uax | grep -i "java -jar ServerManager.ja[r]" | head -n 1 | awk '{print $2}'`
RETVAL=$?
echo "";
return $RETVAL
}
restart() {
stop
start
}
case $1 in
start)
start
;;
stop)
stop
;;
*)
echo $"Usage: servermngr {start|stop}"
exit 3
esac
exit $RETVAL
The only thing I can think of is the Jar is not running in a shell?? Does anyone have any ideas how to get this working??
Thanks for any ideas