Respawn httpd using init


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Respawn httpd using init
# 1  
Old 11-24-2010
Respawn httpd using init

How to auto restart httpd(apache) with inittab respawn?
# 2  
Old 11-24-2010
I suppose since it is not done natively, its because there seem to be a good reason...

You could bypass my lack of collaboration on this point (/etc/inittab) by writing a job run by cron to check if httpd is there, and if not, warns you ... ( or restart...).
# 3  
Old 11-25-2010
HTML Code:
I suppose since it is not done natively, its because there seem to be a good reason...
Will u plz explain a bit....
# 4  
Old 11-25-2010
I would check out Monit
# 5  
Old 11-25-2010
Depending on exactly how initd is implemented, this inittab line might work, assuming you want httpd running in run levels 3, 4, and 5:

Code:
http:345:respawn:/path/to/httpd/startup/script

I'm assuming you're going to need a script to set up the proper environment. I'd also make sure the script either exec's the httpd, or waits for it to finish, because if the script process ends but leaves the httpd process running initd will probably start another copy of httpd.

You might also need to add some SIGTERM or SIGQUIT handling to your script if it doesn't exec the httpd process.
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Web Development

Httpd not starting

I compiled apache 2.2.15 from source and installed it. When I try to start it, its not coming up. # ./httpd -k start # echo $? 1 # ps -ef | grep httpd | grep -v grep # # ./httpd -v Server version: Apache/2.2.15 (Unix) Server built: Dec 13 2013 04:31:41When I run it in gdb I am... (4 Replies)
Discussion started by: chacko193
4 Replies

2. Red Hat

init-script failing because of /etc/rc.d/init.d/functions

I encountered a problem on one of our database servers. OS: CentOS 5.5 final Kernel: 2.6.18-238.5.1.el5.028stab085.2 (OpenVZ kernel) We wrote some DB-Start/Stop-scripts ("/db2/admin/scripts_dba/start_services.ksh" and ".../stop_services.ksh") to start the database instances. (Database... (1 Reply)
Discussion started by: bakunin
1 Replies

3. Solaris

What is the diffe b/w init s and init S

i did my research in finding the answer but couldn't find right one. Please give your inputs. (6 Replies)
Discussion started by: ranumala
6 Replies

4. UNIX for Advanced & Expert Users

Problem on init 0, execution is the same with init 6

Hi, I am experiencing a weird thing on my SUNFIRE machine with Solaris 9 OS. When I do init 0 to shutdown the machine to go to ok prompt, what it did was shutdown and reboot like an init 6 command do. I did check the corresponding rc scripts that were involved with init 0 and compared with rc... (2 Replies)
Discussion started by: Yenthanh
2 Replies

5. Red Hat

Difference between 'init s' and 'init 1'

What is the difference between 'init s' and 'init 1'. I know that both will work to change the current run level to single user mode. Is there any difference in those two commands? (5 Replies)
Discussion started by: praveen_b744
5 Replies

6. Linux

How to I change init levels after typing init 1

Dear all, I typed in init 1 on my redhat box as root and according to wikipedia (http://en.wikipedia.org/wiki/Runlevel): 1 Single-User Mode Does not configure network interfaces, start daemons, or allow non-root logins So now I can't connect back to it. How do I change the init back to 3?... (8 Replies)
Discussion started by: z1dane
8 Replies

7. Solaris

How to avaoid the respawn

Hi All, I have started my processes through SMF functionality. It gets started successfully. But when I kill my processes, it's getting restarted. But in Solaris 9 and below if I kill it will not get restarted. In Solaris 10 it should not get restarted L How can I perform the operation... (5 Replies)
Discussion started by: kalpeer
5 Replies

8. Solaris

different between /sbin/init and /usr/sbin/init

root@test09 # ls -al /sbin/init -r-xr-xr-x 1 root sys 550000 Jun 29 2002 /sbin/init root@test09 # ls -al /usr/sbin/init -r-xr-xr-x 1 root sys 37100 Jun 29 2002 /usr/sbin/init (2 Replies)
Discussion started by: userking
2 Replies

9. Solaris

java process does not respawn

Hi, I am working on Solaris 8 on sunblade 150 machine.I have a java code jar file which I have configured in inittab to respawn.When I kill the process as per the respawn property the new process id gets generated.If I keep killing the process after 4-5 tries the process does not respawn.Sometimes... (0 Replies)
Discussion started by: girish_shukla
0 Replies

10. UNIX for Advanced & Expert Users

Init 6 & Init 0 problem

Hi Expert, I have encountered some problem with my SUN system. Everytime when i issue command #init 6 OR #init 0 it just logout and prompt for login again instead of rebooting the server when run init 6 and system shutdown when run init 0.. I can only reboot the system using reboot ... Was... (6 Replies)
Discussion started by: sc2005
6 Replies
Login or Register to Ask a Question