<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Newbie needs help with starting Java daemons at boot up time. in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/newbie-needs-help-with-starting-java-daemons-at-boot-up-time/m-p/2798971#M81533</link>
    <description>Almost certainly it is your su - aceacct1 rather than simply su aceacct1. I know - you want to run aceacct1's .profile so that his environment is set up BUT the problem with that is that there are are number of commands like tset, tabs ... that expect an interactive environment - which you ain't. The best solution is to create a file, e.g. /usr/local/bin/myenv.sh that sets and exports any needed variables. Make sure that there are no returns or exits in this file. You then source this file (e.g. . /usr/local/bin/myenv.sh) in both your init.d script and aceacct1's .profile.</description>
    <pubDate>Tue, 03 Sep 2002 20:49:24 GMT</pubDate>
    <dc:creator>A. Clay Stephenson</dc:creator>
    <dc:date>2002-09-03T20:49:24Z</dc:date>
    <item>
      <title>Newbie needs help with starting Java daemons at boot up time.</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/newbie-needs-help-with-starting-java-daemons-at-boot-up-time/m-p/2798970#M81532</link>
      <description>Demographics:&lt;BR /&gt;I am running on a HP-UX. &lt;BR /&gt;I have built 3 shell scripts to run as daemons when the box is booted.  &lt;BR /&gt;The scripts are located in /sbin/init.d. &lt;BR /&gt;All 3 scripts are using the same job name ???aceacct1???.&lt;BR /&gt;The main function of the script is to start the java vm (Sun 1.3) and run an application&lt;BR /&gt;     coded in Microsoft J++ ( realize there will be some people seeing red). &lt;BR /&gt;&lt;BR /&gt;Problem description:&lt;BR /&gt;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.&lt;BR /&gt;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.&lt;BR /&gt;I use the same account to start all 3 scripts manually and at boot time.&lt;BR /&gt;&lt;BR /&gt;Application description:&lt;BR /&gt;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.&lt;BR /&gt;&lt;BR /&gt;Script description:&lt;BR /&gt;The only difference in the scripts is the main class that the vm starts, and where that class exists.  Here, is it ConfigurationService.  &lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Code:&lt;BR /&gt;&lt;BR /&gt;/usr/bin/su - aceacct1 -c " . .profile;   /opt/java1.3/bin/java com.allstate.infrastructure.configuration.internals.Conf&lt;BR /&gt;igurationService &amp;amp;"&lt;BR /&gt;rval=$?;&lt;BR /&gt;set_return;&lt;BR /&gt; ;;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;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.&lt;BR /&gt;</description>
      <pubDate>Tue, 03 Sep 2002 20:42:43 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/newbie-needs-help-with-starting-java-daemons-at-boot-up-time/m-p/2798970#M81532</guid>
      <dc:creator>Alex MacKay</dc:creator>
      <dc:date>2002-09-03T20:42:43Z</dc:date>
    </item>
    <item>
      <title>Re: Newbie needs help with starting Java daemons at boot up time.</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/newbie-needs-help-with-starting-java-daemons-at-boot-up-time/m-p/2798971#M81533</link>
      <description>Almost certainly it is your su - aceacct1 rather than simply su aceacct1. I know - you want to run aceacct1's .profile so that his environment is set up BUT the problem with that is that there are are number of commands like tset, tabs ... that expect an interactive environment - which you ain't. The best solution is to create a file, e.g. /usr/local/bin/myenv.sh that sets and exports any needed variables. Make sure that there are no returns or exits in this file. You then source this file (e.g. . /usr/local/bin/myenv.sh) in both your init.d script and aceacct1's .profile.</description>
      <pubDate>Tue, 03 Sep 2002 20:49:24 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/newbie-needs-help-with-starting-java-daemons-at-boot-up-time/m-p/2798971#M81533</guid>
      <dc:creator>A. Clay Stephenson</dc:creator>
      <dc:date>2002-09-03T20:49:24Z</dc:date>
    </item>
    <item>
      <title>Re: Newbie needs help with starting Java daemons at boot up time.</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/newbie-needs-help-with-starting-java-daemons-at-boot-up-time/m-p/2798972#M81534</link>
      <description>Your "daemon" is probably just dying because it recieves a SIGHUP signal when the /sbin/rc completes. To properly daemonize a process it needs to ignore SIGHUP. You can do that with java by just using the nohup command to start java-&lt;BR /&gt;nohup java MyClass&lt;BR /&gt;or&lt;BR /&gt;nohup java MyClass &amp;gt;/dev/null 2&amp;gt;/dev/null&lt;BR /&gt;&lt;BR /&gt;  It looks like the recently added "java -Xrs" option may also prevent SIGHUP termination, but I haven't experimented with it.</description>
      <pubDate>Fri, 06 Sep 2002 19:09:46 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/newbie-needs-help-with-starting-java-daemons-at-boot-up-time/m-p/2798972#M81534</guid>
      <dc:creator>Mike Stroyan</dc:creator>
      <dc:date>2002-09-06T19:09:46Z</dc:date>
    </item>
    <item>
      <title>Re: Newbie needs help with starting Java daemons at boot up time.</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/newbie-needs-help-with-starting-java-daemons-at-boot-up-time/m-p/2798973#M81535</link>
      <description>To Mike Stroyan or anybody else actually.&lt;BR /&gt;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.</description>
      <pubDate>Thu, 12 Sep 2002 14:38:01 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/newbie-needs-help-with-starting-java-daemons-at-boot-up-time/m-p/2798973#M81535</guid>
      <dc:creator>Alex MacKay</dc:creator>
      <dc:date>2002-09-12T14:38:01Z</dc:date>
    </item>
    <item>
      <title>Re: Newbie needs help with starting Java daemons at boot up time.</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/newbie-needs-help-with-starting-java-daemons-at-boot-up-time/m-p/2798974#M81536</link>
      <description>The classical SIGHUP use is for a person logging out of a terminal session.  The SIGHUP signal is sent to all the processes that were using that terminal as their "controlling tty".  It tells the processes to  react to the logout.&lt;BR /&gt;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.)&lt;BR /&gt;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.&lt;BR /&gt;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&lt;BR /&gt;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.</description>
      <pubDate>Thu, 12 Sep 2002 15:47:34 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/newbie-needs-help-with-starting-java-daemons-at-boot-up-time/m-p/2798974#M81536</guid>
      <dc:creator>Mike Stroyan</dc:creator>
      <dc:date>2002-09-12T15:47:34Z</dc:date>
    </item>
    <item>
      <title>Re: Newbie needs help with starting Java daemons at boot up time.</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/newbie-needs-help-with-starting-java-daemons-at-boot-up-time/m-p/2798975#M81537</link>
      <description>Alex,&lt;BR /&gt;&lt;BR /&gt;I had a similar problem starting a http daemon.  The solution was to use "nohup" but I had to call out the whole path&lt;BR /&gt;&lt;BR /&gt;/usr/sbin/nohup&lt;BR /&gt;&lt;BR /&gt;So if Mike's solution does not appear to work right away, it may be that your PATH variable is not including /usr/sbin&lt;BR /&gt;&lt;BR /&gt;Once I called out the correct path, everything works.&lt;BR /&gt;&lt;BR /&gt;nohup means "no hangup" when the shell that started the process quits.  It will continue to run in the background.&lt;BR /&gt;&lt;BR /&gt;- Allan</description>
      <pubDate>Thu, 12 Sep 2002 16:03:52 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/newbie-needs-help-with-starting-java-daemons-at-boot-up-time/m-p/2798975#M81537</guid>
      <dc:creator>Allan Pincus</dc:creator>
      <dc:date>2002-09-12T16:03:52Z</dc:date>
    </item>
    <item>
      <title>Re: Newbie needs help with starting Java daemons at boot up time.</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/newbie-needs-help-with-starting-java-daemons-at-boot-up-time/m-p/2798976#M81538</link>
      <description>In resonse to Allen and Mike, I probably was not clear.  I did use the "nohup" command and that fixed the problem completely.  I did not have to specify the path with nohup, the path variables had been set for usr, etc.&lt;BR /&gt;So in the script I have&lt;BR /&gt;   &lt;BR /&gt;nohup /opt/java1.3/bin/java  classpath/class &amp;amp;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;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? &lt;BR /&gt; &lt;BR /&gt;</description>
      <pubDate>Thu, 12 Sep 2002 17:36:35 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/newbie-needs-help-with-starting-java-daemons-at-boot-up-time/m-p/2798976#M81538</guid>
      <dc:creator>Alex MacKay</dc:creator>
      <dc:date>2002-09-12T17:36:35Z</dc:date>
    </item>
    <item>
      <title>Re: Newbie needs help with starting Java daemons at boot up time.</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/newbie-needs-help-with-starting-java-daemons-at-boot-up-time/m-p/2798977#M81539</link>
      <description>Can anyone tell me how I get the rabbit in the hat applied to Mike's first answer since that is the answer that solved the problem.  THANKS...</description>
      <pubDate>Thu, 12 Sep 2002 17:36:42 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/newbie-needs-help-with-starting-java-daemons-at-boot-up-time/m-p/2798977#M81539</guid>
      <dc:creator>Alex MacKay</dc:creator>
      <dc:date>2002-09-12T17:36:42Z</dc:date>
    </item>
  </channel>
</rss>

