LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   How To Use Java Program(.jar) As Start Up Service RHEL 5 Giving Error ?? (https://www.linuxquestions.org/questions/linux-newbie-8/how-to-use-java-program-jar-as-start-up-service-rhel-5-giving-error-926651/)

mohsin2013 01-31-2012 12:13 AM

How To Use Java Program(.jar) As Start Up Service RHEL 5 Giving Error ??
 
hi i have created my jar file PingConsolApps.jar and i have run this jar file at terminal running fine now o want to add it as a service that would start up on boot so i have put my jar file in "/home" place and i have created file PingConsolApps in etc/init.d as following this site,

http://www.shayanderson.com/linux/ad...-on-bootup.htm

but i have edited it here,
Code:


#! /bin/sh

case "$1" in
      start)
            cd /home/
            /usr/bin/java -jar PingConsolApps.jar &
            ;;
      stop)
            killall -v java
            ;;
esac
exit 0

i gave permission to it ,

Code:

chmod +x /etc/init.d/PingConsolApps
and after it i execute,

Code:

chmod 777 /etc/init.d/PingConsolApps
i try to start its service

Code:

/etc/init.d/PingConsolApps start
it does not show any error but after it i check it using

Code:

service PingConsolApps status
it does not show any thing and do not give ant error i check it in running service,

Code:

service --status -all
i do not get it there also

when i try to stop it

Code:

/etc/init.d/PingConsolApps stop
it give error "java: no process killed"

if it run this service then my sql data base would be updates while it do not up date ???

what are the mistakes in this script help me out to get my goals i am new to linux and development to specially like creating this services

Thanks in Advance

John VV 01-31-2012 04:48 AM

you are missing a VERY important folder
from your post you DO NOT have a normal user account made
there is no ~/ home folder

/home/UserName/ThenTheFile

also never,NEVER , NEVER run chmod 777 on anything in /bin or /etc , /share ,... NEVER
SElinux will through a temper tantrum . i am betting that "SELinuxTroubleShooter" is giving a warning
Quote:

chmod 777 /etc/init.d/PingConsolApps
is not good

it also needs to be owned by root and NOT executable by EVERYONE in the world

if the file permissions for a system file are off( not set right) a reboot will not boot SE will stop it

Seeing as red hat ( RHEL) is not a free operating system .
Have you searched the red hat knowledge base ?
https://access.redhat.com/knowledge/search
you will have to login to red hat site using the username you set up when you bought the REQUIRED subscription


also you might want to read the red hat 5 documentation
https://access.redhat.com/knowledge/...erprise_Linux/
http://docs.redhat.com/docs/en-US/Re...-run-boot.html


All times are GMT -5. The time now is 11:49 AM.