- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- restarting init.d script without rebooting
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
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
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-21-2002 04:45 AM
тАО08-21-2002 04:45 AM
I know I can do this, but I can't seem to locate the reference.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-21-2002 04:47 AM
тАО08-21-2002 04:47 AM
Re: restarting init.d script without rebooting
Sure, just do "/sbin/init.d/SCRIPTNAME start"
Pete
Pete
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-21-2002 04:48 AM
тАО08-21-2002 04:48 AM
Re: restarting init.d script without rebooting
Thanks for this input!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-21-2002 04:50 AM
тАО08-21-2002 04:50 AM
Re: restarting init.d script without rebooting
What errors, if any, are you getting in the /etc/rc.log file when these scripts don't start?
Rgds,
Jeff
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-21-2002 04:55 AM
тАО08-21-2002 04:55 AM
Re: restarting init.d script without rebooting
I see the script start, with no errors. I've had the script spit out everything to /etc/rc.log, with no problems.
Now I'm trying to start my script with nohup, just to see if it works.
When I run the Start script (S101
Weird.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-21-2002 04:57 AM
тАО08-21-2002 04:57 AM
Re: restarting init.d script without rebooting
You can try bringing the server down to the run level below the one you want to run the scripts for - i.e. 2 in this case - but it can be just as catastrophic for the applications as a reboot and may not clean up properly:
init 2
init 3
Don't know if that's of any use???
Ollie.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-21-2002 04:58 AM
тАО08-21-2002 04:58 AM
Re: restarting init.d script without rebooting
Jeff
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-21-2002 05:09 AM
тАО08-21-2002 05:09 AM
Re: restarting init.d script without rebooting
#!/sbin/sh
or whatever you have from
echo $SHELL (when you are successful
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-21-2002 09:43 AM
тАО08-21-2002 09:43 AM
Re: restarting init.d script without rebooting
then
/sbin/init.d/SCRIPTNAME start
Good Luck.
Steve
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-21-2002 09:48 AM
тАО08-21-2002 09:48 AM
Re: restarting init.d script without rebooting
If you script works when you manually launch it but not during bootup, I'd look to differences in the environment. Make sure that you have a PATH declaration in your script along with any other variables that you would "normally" have if your $HOME/.profile had been sourced.
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-21-2002 10:51 AM
тАО08-21-2002 10:51 AM
SolutionI had the same problems before, and I got some hint from this forum. It seemed that if the App/process you are trying to bring up from /sbin/init.d at boot time is not a Daemon, it won't last. That's why even though you saw everything is fine from /etc/rc.log, still it's not up, because it exit after 1 or 2 seconds.
To solve this problem, there're 2 ways:
1. write your wrapper scripts, put what ever in the /sbin/init.d/your-script start part in this wrapper, and make it a daemon, then call this wrapper from /sbin/init.d/your-script
2. write a script, put all the start-up part from your origenal script into this script, and put it somewhere else, say "/", then in the /sbin/init.d/your-script start part, instead of calling this new script directly, using "at" command to schedule it start after 5 or 10 mins ( depend on how long the whole system will start up normally), then it will start with normal way -- like you did to call this script from command line.
the 2nd solution is simple, the key is to make the proper time for "at" command, so that it will start soon after the system is booted. But if there's other Apps you put at /sbin/init.d which have dependency on this App , you can only use solution 1.
hope it helps,
Gary
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-21-2002 11:35 AM
тАО08-21-2002 11:35 AM
Re: restarting init.d script without rebooting
HTH
Marty
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-21-2002 12:43 PM
тАО08-21-2002 12:43 PM
Re: restarting init.d script without rebooting
If I understand your question correctly:
You can start up a script manually by /sbin/init.d/<scriptname> start/stop
However, some scripts depend on others to be started in a particular order in order to run properly. Also, some scripts don't like to be "start"ed without being "stop"ped first.
For example, /sbin/init.d/net will be annoyed if /sbin/init.d/hostname wasn't run first.
The best way to figure the safest way to start a daemon process is to figure what it depends on (if applicable) and in what order and follow it.
Open question - I just now thought about this. Linux has a restart option in many of it's /etc/init.d scripts. Does HP-UX? I've never thought to try it.
HTH,
Kel
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-21-2002 12:56 PM
тАО08-21-2002 12:56 PM
Re: restarting init.d script without rebooting
Appears only the sshd daemon has an explicit restart sequence out of the box. Although others like swagentd can be restarted with parms on the command line. (swagentd -r).
But it would be fairly straightforward to set up a restart case value in any - as long as they can be stopped/started normally.
See /sbin/init.d/sshd2 for an example.
BTW - New hat looks good!!
Rgds,
Jeff
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-21-2002 01:19 PM
тАО08-21-2002 01:19 PM
Re: restarting init.d script without rebooting
I'm sorry, I wasn't giving your question my full attention. I read the rc3.d comment and then ignored it in my note.
The easiest way might possible be to write a script that starts all the scripts linked in rc3.d and test it on a non production unit first to help ensure as little risk of problems as possible.
I know of no builtin way accomplish this.
Also - I received a usage statement when I attempted "restart" on a process for grins.
Good luck,
Kel
N/A for this one please.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-21-2002 01:24 PM
тАО08-21-2002 01:24 PM
Re: restarting init.d script without rebooting
This hat's pretty comfortatble. I like it.
I'm looking forward to trying on the pointy one.
Kel
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-22-2002 02:38 AM
тАО08-22-2002 02:38 AM
Re: restarting init.d script without rebooting
your original question is, how to "simulate" a reboot without actually reboot the system. This can be done by changing to the single user mode and than going back to the run-level you like. The system actually does no reboot:
# shutdown 0 # change to single user mode
# init 3 # change to run level 3 (rc3.d)
All the init.d scripts have been stopped and started again without reboot.
When you are writing the startup script by your own, you have to be very careful. Not just start any program and expecting it is there. Do also check if the desired programs are there where they are expected, check if they can be executed, check if all necessary configurations are done (best to do inside /etc/rc.config.d), check what the exit values of the started programs are. You have to program your startup message by your own, in your startup script you have to decide when your startup message has been appended with an "OK", "FAIL", or "N/A". Check if your desired process is really running after executing the main part of your startup script, if not your startup script has to exit with returning 1.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-22-2002 04:28 AM
тАО08-22-2002 04:28 AM
Re: restarting init.d script without rebooting
If that is the (suspected) scenario, then - assuming that you normally start "the process" as "/path/to/the_process &" -, start "the process" as follows:
[stuff in your script]
nohup /path/to/the_process &1 >>/the_process.log &
sleep 10
ps -ef | grep the_process >>/the_process.log
The nohup(1) is a safeguard in case the_process is not a real daemon, i.e. it will die when the (shell executing the) script terminates.
The redirection is to catch all messages.
The sleep(1) is to allow nohup(1) time to do its work, i.e. a "nohup .... &" at the end of the script is likely to fail because the script will terminate before nohup(1) has been able to do its work (ignoring SIGHUP and SIGQUIT).
The ps(1) is to make sure that the_process has really started.
If you need more help, then please post your script and the logs.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-22-2002 04:35 AM
тАО08-22-2002 04:35 AM
Re: restarting init.d script without rebooting
# echo "your_manual_command" | batch
Where "your_manual_command" is the full path/command which you successfully execute from an interactive shell.
Other test:
# your_manual_command
[check if it ran OK and the daemon is running]
# exit
login: ...
...
[check if the daemon is *still* running]
If the daemon *was* running, but no longer *is* running, then it is not a real daemon, i.e. it can not handle that (the shell that executes) the calling script terminates, i.e. you *must* use nohup(1) (see my previous response).
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-22-2002 05:28 AM
тАО08-22-2002 05:28 AM
Re: restarting init.d script without rebooting
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-22-2002 07:02 AM
тАО08-22-2002 07:02 AM
Re: restarting init.d script without rebooting
Typically most machines default to run level three.
So make sure to put a link in /sbin/rc3.d as S999xvfb pointing to /sbin/init.d/xvfb.
cd /sbin/rc3.d
ln -s /sbin/init.d/xvfb S999xvfb
chmod 755 S999xvfb
Check /etc/inittab to see what the default run level it.
Check /etc/rc.log to see what if any error messages happen when the system boots.
Finally I would make sure that /sbin/init.d/xvfb sets any environment variables that you need. There may be vars set when you log in that aren't set at boot time so they aren't available when the command is executed.
Not the last part especially.