- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: Newbie needs help with starting Java daemons a...
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-03-2002 01:42 PM
09-03-2002 01:42 PM
I am running on a HP-UX.
I have built 3 shell scripts to run as daemons when the box is booted.
The scripts are located in /sbin/init.d.
All 3 scripts are using the same job name ???aceacct1???.
The main function of the script is to start the java vm (Sun 1.3) and run an application
coded in Microsoft J++ ( realize there will be some people seeing red).
Problem description:
When I start the scripts from a HyperTerminal session they all start fine, the application runs without any problems. There are no issues at all.
When I start the script via the root at boot up time, one of the scripts will not start properly and dies. I start the same scripts whether manually or via boot up.
I use the same account to start all 3 scripts manually and at boot time.
Application description:
The application is a logging application with three pieces. It is a lightweight application that uses port and socket processing for communication. Thus the application can run on separate box or the same box. I am developing the scripts on the same box.
Script description:
The only difference in the scripts is the main class that the vm starts, and where that class exists. Here, is it ConfigurationService.
Code:
/usr/bin/su - aceacct1 -c " . .profile; /opt/java1.3/bin/java com.allstate.infrastructure.configuration.internals.Conf
igurationService &"
rval=$?;
set_return;
;;
At this point, the only thing I can think of is that there was something set up incorrectly or missed that deals with the authority.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-03-2002 01:49 PM
09-03-2002 01:49 PM
Re: Newbie needs help with starting Java daemons at boot up time.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-06-2002 12:09 PM
09-06-2002 12:09 PM
Solutionnohup java MyClass
or
nohup java MyClass >/dev/null 2>/dev/null
It looks like the recently added "java -Xrs" option may also prevent SIGHUP termination, but I haven't experimented with it.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-12-2002 07:38 AM
09-12-2002 07:38 AM
Re: Newbie needs help with starting Java daemons at boot up time.
Mike, your answer was 100% correct and fixed the problem entirely. I have been trying to read about nohup with limited success. Can you explain in detail exactly what is happening? If anyone can I would appreciate it.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-12-2002 08:47 AM
09-12-2002 08:47 AM
Re: Newbie needs help with starting Java daemons at boot up time.
The rc scripts are run by a shell process that is a "process group leader", so when it exits the descendent processes are also sent a SIGHUP. Programs that want to be long running "daemon" processes need to prevent that SIGHUP from killing them. They can either change their process group or change their reaction to SIGHUP. Changing the process group can be done with any of setsid, setpgid, setpgid2, or setpgrp. (Everyone seems to want to invent their own way to do that.)
There are even more ways for a process to change its reaction to a signal. There are many, many functions for setting signal handling. The "java -Xrs" option uses some of those functions to change signal handling.
Plus, the signal handling can actually be fixed up by a starting command without rebuilding the program. The nohup command actually sets the signal handling for SIGHUP
to SIG_IGN instead of the default SIG_DFL, which would exit for SIGHUP. nohup then runs the command that you give it. That inherits the SIG_IGN, so your java command will successfully ignore the SIGHUP that it gets when rc exits.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-12-2002 09:03 AM
09-12-2002 09:03 AM
Re: Newbie needs help with starting Java daemons at boot up time.
I had a similar problem starting a http daemon. The solution was to use "nohup" but I had to call out the whole path
/usr/sbin/nohup
So if Mike's solution does not appear to work right away, it may be that your PATH variable is not including /usr/sbin
Once I called out the correct path, everything works.
nohup means "no hangup" when the shell that started the process quits. It will continue to run in the background.
- Allan
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-12-2002 10:36 AM
09-12-2002 10:36 AM
Re: Newbie needs help with starting Java daemons at boot up time.
So in the script I have
nohup /opt/java1.3/bin/java classpath/class &
This was the first Java daemon started at boot up etc., that we had that I am aware of. None of the other boot up scripts/daemons have this problem. But then again, they are not java. Can I assume this only applies to Java daemons or are the other cases where booting up will require the "nohup" command?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-12-2002 10:36 AM
09-12-2002 10:36 AM