- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- making a startup script
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
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
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
тАО08-14-2006 07:46 AM
тАО08-14-2006 07:46 AM
making a startup script
Now, what do i do with it.
What i think i have to make a file in /sbin/rc2.d and make a file like S002 and then just put the command in it. And also make k002 so that the command is killed at shutdown time.
Any suggestions.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-14-2006 07:53 AM
тАО08-14-2006 07:53 AM
Re: making a startup script
Eg.
/sbin/init.d/script is the startup script.
create a soft link in /sbin/rc3.d/ as S999script to start the script in rc3
and
softlink in /sbin/rc2.d/ as K999script to stop the script in rc2.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-14-2006 07:53 AM
тАО08-14-2006 07:53 AM
Re: making a startup script
there is a template in /sbin/init.d that you can use for the main script. Put you stop and start commands in the script, as well as the name of the flag file you will create in /etc/rc.config.d
Once you have your script complete, link it to /sbin/rc3.d for the start and to /sbin/rc2.d for the stop. the numbers of the S and K links should add up to 1000
ie S900app and K100app
the file in /etc/rc.config.d contains a variable set to either 1 or 0 - this tells the script to run (1), and not to run (0)
See existing scripts for detailed examples
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-14-2006 07:53 AM
тАО08-14-2006 07:53 AM
Re: making a startup script
-copy that file to something like myservice. -make your new file executable.
-edit that file to include your startup and shutdown commands and change the CONTROL_VARIABLE to a variable name of your choice.
-create a file in a file /etc/rc.config.d/myservice this file contains your variable that you just defined =1. i.e. myservice_var=1
-in /sbin/rc3.d create a link to /sbin/init.d/myservice . i.e. ln -s /sbin/init.d/myservice S900myservice
-in /sbin/rc2.d create a link to /sbin/init.d/myservice . i.e. ln -s /sbin/init.d/myservice K900myservice
-You are done.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-14-2006 07:57 AM
тАО08-14-2006 07:57 AM
Re: making a startup script
UNIX because I majored in cryptology...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-14-2006 07:59 AM
тАО08-14-2006 07:59 AM
Re: making a startup script
First cd to /sbin/init.d and copy the file "template" to another file, e.g. myscript
Now modify myscript to do what it is you want to do. You will see 4 sections inside a case statement start_msg) what to print while the machine is booting and starting your service. start) Actual startup for your service. stop_msg) what to print while the machine is stopping your servide during shutdown. stop) Actual shutdown commands for your service.
You should also create a file something like /etc/rc.config.d/myscript that contains any control variables that your startup/shutdown scripts might need. A very common convention is something like
MY_CONTROL_VAR=1 # set to 1 if myscript should actually run
Next, text your script by manually executing it;
e.g. /sbin/init.d/myscript start {or stop}
Finally, you create symbolic links in the rc directories to start/stop your scripts. Normally, if you start at run-level N, you stop at run-level N - 1; also your 'K' 3-digit numbers and your 'S' 3-digit numbers should sum to 1000. This conventions tends to correctly order the start/stop sequence. In your example, and assumming that starting early in run-level 2 is correct (which is doubtful) the links would look like this:
ln -s /sbin/init.d/myscript /sbin/rc2.d/S002myscript
ln -s /sbin/init.d/myscript /sbin/rc1.d/K998myscript