<?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: Startup Script in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/startup-script/m-p/2657249#M47490</link>
    <description>Okay Dave, &lt;BR /&gt;&lt;BR /&gt;This is not difficult. Just because a script runs when you execute it via an interactive shell does not mean that it will execute correctly at startup. The main difference is that you need to make sure that your path is correctly set and exported. Do this somewhere explicitly in your script or use absolute pathnames. Any other environment variables that are normally set in your .profile need to also be explicitly set in your script as well.&lt;BR /&gt;By convention, any variables that your script needs are set in a file /etc/rc.config.d/myscript then /etc/rc.config.d/myscript is included in your actual script like this:&lt;BR /&gt;if [ -r /etc/rc.config.d/myscript ]&lt;BR /&gt;  then&lt;BR /&gt;    . /etc/rc.config.d/myscript &lt;BR /&gt;&lt;BR /&gt;  fi&lt;BR /&gt;&lt;BR /&gt;You actual script should be installed in /sbin/init.d/myscript and then linked symbolically to the appropriate startup and shutdown directories. In your case, you decided to start in run level 2 so you need to stop in run level 1. You need to decide if your startup is dependent upon any other services and order your 'S' file so that it falls after any required scripts.&lt;BR /&gt;&lt;BR /&gt;Let's say that you have determined myscript (uagent - in your case)  needs to start after S950xxx has run. Let's then choose S952myscript as a file name and create the link. &lt;BR /&gt;ln -s /sbin/init.d/myscript /sbin/rc2.d/S952myscript&lt;BR /&gt;&lt;BR /&gt;Now by cenvertion the 'S' Number + the 'K' number should add to 1000 and be zero-padded if necessary to 3 digits. This almost always insure the correct lexical order. Now let's create the kill script&lt;BR /&gt;ln -s /sbin/init.d/myscript /sbin/rc1.d/K048myscript&lt;BR /&gt;&lt;BR /&gt;That's all there is to it, Clay&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;If you taken care of that, the rest is easy.&lt;BR /&gt;&lt;BR /&gt;</description>
    <pubDate>Fri, 01 Feb 2002 18:46:57 GMT</pubDate>
    <dc:creator>A. Clay Stephenson</dc:creator>
    <dc:date>2002-02-01T18:46:57Z</dc:date>
    <item>
      <title>Startup Script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/startup-script/m-p/2657245#M47486</link>
      <description>I have a program that I would like to start up when the system boots and I am a little shakey about how?  I have looked @ some of the scripts in /sbin/rc2.d but don't want to screw anything up.&lt;BR /&gt;&lt;BR /&gt;  The way the program starts from command line is: uagent start&lt;BR /&gt;&lt;BR /&gt;Again Thanks in advance :-)&lt;BR /&gt;&lt;BR /&gt;DaveAA2&lt;BR /&gt;</description>
      <pubDate>Fri, 01 Feb 2002 18:26:03 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/startup-script/m-p/2657245#M47486</guid>
      <dc:creator>Dave Aalbertsberg</dc:creator>
      <dc:date>2002-02-01T18:26:03Z</dc:date>
    </item>
    <item>
      <title>Re: Startup Script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/startup-script/m-p/2657246#M47487</link>
      <description>Hi Dave,&lt;BR /&gt;&lt;BR /&gt;You can put the script "uagent" in /sbin/init.d. Net create a file in /sbin/rc2.d called Sxxxuagent. This should be linked to /sbin/init.d/uagent,&lt;BR /&gt;&lt;BR /&gt;cd /sbin/rc2.d&lt;BR /&gt;ln -s /sbin/init.d/uagent Sxxxuagent&lt;BR /&gt;&lt;BR /&gt;If the same script can be called with a stop command, add another entry to /sbin/rc1.d&lt;BR /&gt;&lt;BR /&gt;cd /sbin/rc1.d&lt;BR /&gt;ln -s /sbin/init.d/uagent Kyyyuagent&lt;BR /&gt;&lt;BR /&gt;The converntion is xxx+yyy=1000&lt;BR /&gt;&lt;BR /&gt;If you use this, The application uagent will be started at run level 2 and will be shutdown at run level 1.&lt;BR /&gt;&lt;BR /&gt;Hope this helps.&lt;BR /&gt;&lt;BR /&gt;Regds&lt;BR /&gt;</description>
      <pubDate>Fri, 01 Feb 2002 18:38:16 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/startup-script/m-p/2657246#M47487</guid>
      <dc:creator>Sanjay_6</dc:creator>
      <dc:date>2002-02-01T18:38:16Z</dc:date>
    </item>
    <item>
      <title>Re: Startup Script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/startup-script/m-p/2657247#M47488</link>
      <description>Dave-&lt;BR /&gt;&lt;BR /&gt;If you look in /sbin/init.d, there is a file called template.  You can use this to build your script.  I would suggest just looking at the other scripts as well to get a feel for how to do it.  As far as the number, the  S900 level is free for user apps, so pick a number in there to use (we have apache launching under the S940apache script in /sbin/rc2.d).  As long as you don't modify other files, you shouldn't screw up anything.  Worst case, the app doesn't launch, and you go back and try again.  Good luck!&lt;BR /&gt;&lt;BR /&gt;Mark&lt;BR /&gt;</description>
      <pubDate>Fri, 01 Feb 2002 18:41:08 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/startup-script/m-p/2657247#M47488</guid>
      <dc:creator>Mark Vollmers</dc:creator>
      <dc:date>2002-02-01T18:41:08Z</dc:date>
    </item>
    <item>
      <title>Re: Startup Script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/startup-script/m-p/2657248#M47489</link>
      <description>If you look in at /sbin/init.d, there is a file called "template" which you can actually use for your startup program. Place your command appropriately and you would want to create a control file in /etc/rc.config.d and replace $CONTROL_VARIABLE with the variable name that you have chosen. Then follow Sanjay's procedure.</description>
      <pubDate>Fri, 01 Feb 2002 18:44:56 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/startup-script/m-p/2657248#M47489</guid>
      <dc:creator>S.K. Chan</dc:creator>
      <dc:date>2002-02-01T18:44:56Z</dc:date>
    </item>
    <item>
      <title>Re: Startup Script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/startup-script/m-p/2657249#M47490</link>
      <description>Okay Dave, &lt;BR /&gt;&lt;BR /&gt;This is not difficult. Just because a script runs when you execute it via an interactive shell does not mean that it will execute correctly at startup. The main difference is that you need to make sure that your path is correctly set and exported. Do this somewhere explicitly in your script or use absolute pathnames. Any other environment variables that are normally set in your .profile need to also be explicitly set in your script as well.&lt;BR /&gt;By convention, any variables that your script needs are set in a file /etc/rc.config.d/myscript then /etc/rc.config.d/myscript is included in your actual script like this:&lt;BR /&gt;if [ -r /etc/rc.config.d/myscript ]&lt;BR /&gt;  then&lt;BR /&gt;    . /etc/rc.config.d/myscript &lt;BR /&gt;&lt;BR /&gt;  fi&lt;BR /&gt;&lt;BR /&gt;You actual script should be installed in /sbin/init.d/myscript and then linked symbolically to the appropriate startup and shutdown directories. In your case, you decided to start in run level 2 so you need to stop in run level 1. You need to decide if your startup is dependent upon any other services and order your 'S' file so that it falls after any required scripts.&lt;BR /&gt;&lt;BR /&gt;Let's say that you have determined myscript (uagent - in your case)  needs to start after S950xxx has run. Let's then choose S952myscript as a file name and create the link. &lt;BR /&gt;ln -s /sbin/init.d/myscript /sbin/rc2.d/S952myscript&lt;BR /&gt;&lt;BR /&gt;Now by cenvertion the 'S' Number + the 'K' number should add to 1000 and be zero-padded if necessary to 3 digits. This almost always insure the correct lexical order. Now let's create the kill script&lt;BR /&gt;ln -s /sbin/init.d/myscript /sbin/rc1.d/K048myscript&lt;BR /&gt;&lt;BR /&gt;That's all there is to it, Clay&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;If you taken care of that, the rest is easy.&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Fri, 01 Feb 2002 18:46:57 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/startup-script/m-p/2657249#M47490</guid>
      <dc:creator>A. Clay Stephenson</dc:creator>
      <dc:date>2002-02-01T18:46:57Z</dc:date>
    </item>
    <item>
      <title>Re: Startup Script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/startup-script/m-p/2657250#M47491</link>
      <description>Hi Dave,&lt;BR /&gt;&lt;BR /&gt;This might be userful,&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://docs.hp.com/hpux/onlinedocs/os/startup.pdf" target="_blank"&gt;http://docs.hp.com/hpux/onlinedocs/os/startup.pdf&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;Hope this helps.&lt;BR /&gt;&lt;BR /&gt;Regds&lt;BR /&gt;</description>
      <pubDate>Fri, 01 Feb 2002 18:48:10 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/startup-script/m-p/2657250#M47491</guid>
      <dc:creator>Sanjay_6</dc:creator>
      <dc:date>2002-02-01T18:48:10Z</dc:date>
    </item>
    <item>
      <title>Re: Startup Script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/startup-script/m-p/2657251#M47492</link>
      <description>Hi Dave:&lt;BR /&gt;&lt;BR /&gt;If you haven't, read either version of the document below. I???ll summarize the key points here. &lt;BR /&gt;&lt;BR /&gt;/usr/share/doc/start_up.txt &lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://docs.hp.com/hpux/onlinedocs/os/startup.html" target="_blank"&gt;http://docs.hp.com/hpux/onlinedocs/os/startup.html&lt;/A&gt; &lt;BR /&gt;&lt;BR /&gt;The file /sbin/init.d/template is a good starting place for making your own start/stop scripts. &lt;BR /&gt;&lt;BR /&gt;The /sbin/init.d directory contains all scripts used to startup and shutdown various subsystems. &lt;BR /&gt;&lt;BR /&gt;Each script under /sbin/init.d should perform BOTH the startup and shutdown functions. In order to control the functionality within the script, each must also support standard arguments and exit codes. Scripts must be written for the POSIX shell. A template script may be found in /sbin/init.d/template. &lt;BR /&gt;&lt;BR /&gt;There is no reason why the startup and shutdown script cannot start/kill multiple, but related processes. Remember to choose the appropriate rc&lt;N&gt;.d directory -- one (1) is for core services; two (2) is for multiuser run-state; three (3) is for networked, multi-user; and four (4) is for graphical interfaces. Depending on the processes you are starting, or stopping, you want to make sure prerequisite services exist. &lt;BR /&gt;&lt;BR /&gt;Each script in /sbin/init.d performs BOTH the startup and shutdown functions, and each will have two links pointing towards the script from /sbin/rc*.d: one for the start action and one for the stop action. &lt;BR /&gt;&lt;BR /&gt;Start scripts begin with "S"; Kill (stop) scripts begin with "K". The order of execution for kill scripts is the reverse of the startup ones. &lt;BR /&gt;&lt;BR /&gt;if a start script is placed in directory '/sbin/rc{X}.d' then its corresponding kill script is put in directory '/sbin/rc{X-1}.d' &lt;BR /&gt;&lt;BR /&gt;A general rule-of-thumb is that the sequence number of the start script plus the sequence number of the kill script should add to 1000. &lt;BR /&gt;&lt;BR /&gt;Subsystems should be killed in the opposite order they were started. This implies that kill scripts will generally not have the same numbers as their start script counterparts. If two subsystems must be started in a given order due to dependencies (e.g., S200sys1 followed by S300uses_sys1), the counterparts to these scripts must be numbered so that the subsystems are stopped in the opposite order in which they were started (e.g., K700uses_sys1 followed by K800sys1). The '1000' rule leads to this behavior. &lt;BR /&gt;&lt;BR /&gt;Regards! &lt;BR /&gt;&lt;BR /&gt;...JRF...&lt;/N&gt;</description>
      <pubDate>Fri, 01 Feb 2002 18:50:21 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/startup-script/m-p/2657251#M47492</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2002-02-01T18:50:21Z</dc:date>
    </item>
    <item>
      <title>Re: Startup Script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/startup-script/m-p/2657252#M47493</link>
      <description>Well folks, once again you have been a great resource.  I played around with the template and looked @ many of the examples in /sbin/init.d.&lt;BR /&gt;  I now have a much better understanding of the whole process and I even got my software to run @ startup.&lt;BR /&gt;  My script is a little crude in fact I am embarrased to show it, but it works.&lt;BR /&gt;&lt;BR /&gt;Again thanks for the swift response :-)&lt;BR /&gt;&lt;BR /&gt;DaveAA2</description>
      <pubDate>Fri, 01 Feb 2002 21:55:33 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/startup-script/m-p/2657252#M47493</guid>
      <dc:creator>Dave Aalbertsberg</dc:creator>
      <dc:date>2002-02-01T21:55:33Z</dc:date>
    </item>
  </channel>
</rss>

