LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   SUSE services (https://www.linuxquestions.org/questions/linux-newbie-8/suse-services-540607/)

dsubbarao 03-26-2007 12:50 AM

SUSE services
 
Hi all
I am new to linux environment. I want to run the java program as service. I could do that in Fedora linux system. but i am not able to do the same in SUSE. My code for init script is

#! /bin/sh
#
### BEGIN INIT INFO
# Provides:
# Required-Start:
# Required-Stop:
# Should-Start:
# Should-Stop:
# Default-Start:
# Default-Stop:
# Description: service to start the java program
### END INIT INFO


RETVAL=0



start() {
echo -n $"Starting Service: "
cd
source setJava --version 1.3
cd /home/nagios/GRE/GRE/
java -jar example.jar

}

stop() {
echo -n $"Stopping Service : "
pkill -f "java -jar example.jar"
RETVAL=$?
return $RETVAL
}
restart(){
stop
sleep 2
start
}
# See how we were called.
case "$1" in
start)
start
;;
stop)
stop
;;
status)
chkconfig Service

;;
restart|reload)
restart
;;
*)
echo "Usage: $0 {start|stop|restart|status}"
exit 1
exit $RETVAL

I don't want to run the service in any runlevel that is whenever i give command as "insserv myservice" then only my service should run.
That's the reason i have left the column " Default-Start: "

when i am adding it through "chkconfig -a /etc/init.d/myservice"
i am getting the excepion as" unknown service not a runlevel service"
Can u tell me where i have done the mistake.

Thanks in Advance

Xian 03-26-2007 01:01 AM

/etc/rc.d/skeleton is the openSUSE template for system service scripts.
Verify that you have met the specific guidelines provided.


All times are GMT -5. The time now is 11:32 PM.