LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices

Reply
 
Search this Thread
Old 01-31-2012, 12:13 AM   #1
mohsin2013
LQ Newbie
 
Registered: Jan 2012
Posts: 1

Rep: Reputation: Disabled
Question 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
 
Old 01-31-2012, 04:48 AM   #2
John VV
Guru
 
Registered: Aug 2005
Posts: 13,060

Rep: Reputation: 1741Reputation: 1741Reputation: 1741Reputation: 1741Reputation: 1741Reputation: 1741Reputation: 1741Reputation: 1741Reputation: 1741Reputation: 1741Reputation: 1741
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

Last edited by John VV; 01-31-2012 at 04:56 AM.
 
1 members found this post helpful.
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to write a daemon Linux service to a Java application which execute a .jar haseit Linux - Newbie 2 10-14-2011 03:10 AM
Java Jar Started via Service cant exec commands on the OS ehask71 Linux - Server 0 08-17-2011 08:03 PM
I got error with this command 'java -jar NodeView-v1.1.jar' mohdismiaswaly Linux - Software 3 04-23-2009 06:24 AM
How to run JAR from within Java program ?! EAD Programming 1 12-31-2006 07:11 PM
How jar java program? treotan Programming 3 09-08-2005 12:03 AM


All times are GMT -5. The time now is 03:01 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration