今天写了个很简单的java程序启动脚本,放在/usr/jspider/下面,直接cd到/usr/jspider下面可以正常运行。而通过chkconfig注册为服务后,servicemyserverstart却启动不了,报找不到class...
今天写了个很简单的java程序启动脚本,放在/usr/jspider/ 下面,直接cd到/usr/jspider下面可以正常运行。而通过chkconfig 注册为服务后,service myserver start 却启动不了,报找不到class:
Exception in thread "main" java.lang.NoClassDefFoundError: org.apache.mina.core.polling.AbstractPollingIoAcceptor
而同样的脚本放在ubuntu10.04上运行却没有任务问题,求高手解答,感谢!
/etc/rc.d/init.d/myserver
#!/bin/bash
# chkconfig: 012345 20 80
# description: jspider server1.0
HOME_DIR=/usr/JSpider/
PID_FILE=$HOME_DIR/jspider.pid
start()
{
echo "start jspider"
cd $HOME_DIR
./startup.sh
exit 0;
}
stop()
{
echo -n "stop jspider"
if kill `cat $PID_FILE`
then
echo " [ok]"
else
echo " [failed]"
fi
}
case "$1" in
start)
start
;;
stop)
stop
;;
restart)
stop
start
;;
*)
echo "usage: $0 start|stop|restart"
exit 0;
esac
startup.sh
#!/bin/sh
java -jar -Xms128M -Xmx1000M jspider.jar /dev/null 2>&1 &
echo $! > jspider.pid
展开