HPE GreenLake Administration
- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: simulate reboot for rc scripts
Operating System - HP-UX
1835242
Members
2118
Online
110078
Solutions
Forums
Categories
Company
Local Language
back
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
back
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
Blogs
Information
Community
Resources
Community Language
Language
Forums
Blogs
Go to solution
Topic Options
- 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
03-15-2004 08:58 AM
03-15-2004 08:58 AM
Hello,
I am constantly having problems running third party software out of rc scripts (or really NOT running - they never seem to start correctly). My current attempts have been trying to start tomcat under a user other than www or root - 4 weeks of reboots trying to get the syntax (su's, nohups, backgrounds) right. These same scripts always run OK from the command line. Any way to simulate a reboot (from the command line - without restarting the machine) for rc scripts so that they can be tested during working hours???
I am constantly having problems running third party software out of rc scripts (or really NOT running - they never seem to start correctly). My current attempts have been trying to start tomcat under a user other than www or root - 4 weeks of reboots trying to get the syntax (su's, nohups, backgrounds) right. These same scripts always run OK from the command line. Any way to simulate a reboot (from the command line - without restarting the machine) for rc scripts so that they can be tested during working hours???
Solved! Go to Solution.
3 REPLIES 3
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-15-2004 09:09 AM
03-15-2004 09:09 AM
Re: simulate reboot for rc scripts
You can run the scripts individually quite easily:
Let's say that you a script mycmd in /sbin/init.d symbolically linked to ../rc3.d/S900mycmd and to ../rc2.d/K100mycmd.
To run the command manually,
/sbin/init.d/mycmd start
to stop it:
/sbin/init.d/mycmd stop
Do this in the lexical order of the commands under the rcN.d directories and you should simulate well. The one "gotcha" is that running interactively like this you are still associated with a controlling terminal so that the emulation is not perfect. In my humble (more or less) opinion, rc scripts which rely upon nohups and backgrounds were not written very well in the first place. Perl has very nice built-ins (fork(),setsid(),nice signal handling) to properly "daemonize" processes.
Let's say that you a script mycmd in /sbin/init.d symbolically linked to ../rc3.d/S900mycmd and to ../rc2.d/K100mycmd.
To run the command manually,
/sbin/init.d/mycmd start
to stop it:
/sbin/init.d/mycmd stop
Do this in the lexical order of the commands under the rcN.d directories and you should simulate well. The one "gotcha" is that running interactively like this you are still associated with a controlling terminal so that the emulation is not perfect. In my humble (more or less) opinion, rc scripts which rely upon nohups and backgrounds were not written very well in the first place. Perl has very nice built-ins (fork(),setsid(),nice signal handling) to properly "daemonize" processes.
If it ain't broke, I can fix that.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-15-2004 09:15 AM
03-15-2004 09:15 AM
Solution
Actually, I use rc4.d and rc3.d for this...
Link the /sbin/init/d./myscript to rc4.d for SXXXmyscript.sh to start and to rc3.d for KXXXmyscript.sh to kill
Then execute init 4, to see if it runs... then init 3 to return to your normal runlevel.
rc4.d is great for testing!!!
Link the /sbin/init/d./myscript to rc4.d for SXXXmyscript.sh to start and to rc3.d for KXXXmyscript.sh to kill
Then execute init 4, to see if it runs... then init 3 to return to your normal runlevel.
rc4.d is great for testing!!!
Unix, the other white meat.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-15-2004 09:32 AM
03-15-2004 09:32 AM
Re: simulate reboot for rc scripts
I'd say go into /sbin/rc to find out what the environment is at startup. put a
file=/tmp/env
set > /tmp/env
stty -a >/tmp/stty
then unset all the variables and aliases in your environment. source in /tmp/env. source in /etc/rc.config. then run your startup script /sbin/init.d/Sxxxyourscript start.
this should get you pretty close. But as Mr. Stephenson points out because of the controlling terminal you'll need to be carefull in how you select your TERM and stty settings.
I suppose if you wanted to go far enough. You could do the above from the command line on the system console.
file=/tmp/env
set > /tmp/env
stty -a >/tmp/stty
then unset all the variables and aliases in your environment. source in /tmp/env. source in /etc/rc.config. then run your startup script /sbin/init.d/Sxxxyourscript start.
this should get you pretty close. But as Mr. Stephenson points out because of the controlling terminal you'll need to be carefull in how you select your TERM and stty settings.
I suppose if you wanted to go far enough. You could do the above from the command line on the system console.
The opinions expressed above are the personal opinions of the authors, not of Hewlett Packard Enterprise. By using this site, you accept the Terms of Use and Rules of Participation.
Company
Events and news
Customer resources
© Copyright 2025 Hewlett Packard Enterprise Development LP