This is a discussion on Apache Startup Script within the Linux Web Servers forums, part of the Web Server and Related Forums category; Being new to Unix, and having examined the 3rd edition of Unix System Admin, I am still having difficulty creating ...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
Being new to Unix, and having examined the 3rd edition of Unix System
Admin, I am still having difficulty creating a startup script for Apache after reboot. I am using /usr/local/apache/bin/apachectl start and /usr/local/apache/bin/apachectl stop but I am not sure how to make the script and into what run level it should be entered. Can you advise? |
|
|||
|
david.knight@bell.ca (Dave) wrote in message news:<a7bcfd30.0310151126.64038e93@posting.google. com>...
> Being new to Unix, and having examined the 3rd edition of Unix System > Admin, I am still having difficulty creating a startup script for > Apache after reboot. I am using /usr/local/apache/bin/apachectl start > and /usr/local/apache/bin/apachectl stop but I am not sure how to make > the script and into what run level it should be entered. What unix? Startup scripts seem to be one place where every vendor goes their own way. For most SysV type systems I've had good luck making init.d/httpd a symlink to apachectl (wherever each of those happens to be.) Then the Sxxhttpd in the appropriate runlevel is a symlink to init.d/httpd. More detail depends on the exact OS. |
|
|||
|
sgarcia@bak.rr.com (Steve) wrote in message news:<f547625f.0310160943.61756354@posting.google. com>...
> david.knight@bell.ca (Dave) wrote in message news:<a7bcfd30.0310151126.64038e93@posting.google. com>... > > Being new to Unix, and having examined the 3rd edition of Unix System > > Admin, I am still having difficulty creating a startup script for > > Apache after reboot. I am using /usr/local/apache/bin/apachectl start > > and /usr/local/apache/bin/apachectl stop but I am not sure how to make > > the script and into what run level it should be entered. > > > What unix? Startup scripts seem to be one place where every vendor > goes their own way. For most SysV type systems I've had good luck > making init.d/httpd a symlink to apachectl (wherever each of those > happens to be.) Then the Sxxhttpd in the appropriate runlevel is a > symlink to init.d/httpd. > > More detail depends on the exact OS. Hmmm...sorry Steve...it's Solaris OE 8 which is Sun OS 5.8 |
|
|||
|
In article <a7bcfd30.0310161322.4eea9d50@posting.google.com >,
david.knight@bell.ca (Dave) writes: > sgarcia@bak.rr.com (Steve) wrote in message news:<f547625f.0310160943.61756354@posting.google. com>... >> david.knight@bell.ca (Dave) wrote in message news:<a7bcfd30.0310151126.64038e93@posting.google. com>... >> > Being new to Unix, and having examined the 3rd edition of Unix System >> > Admin, I am still having difficulty creating a startup script for >> > Apache after reboot. I am using /usr/local/apache/bin/apachectl start >> > and /usr/local/apache/bin/apachectl stop but I am not sure how to make >> > the script and into what run level it should be entered. Newer "Solari" start apache in /etc/rc3.d as S50apache. Lets pretend for the moment you dont have that?? - which would be a little weird. A simple script (call it /etc/rc3.d/S50myapache) could go like so: #!/sbin/sh case "$1" in 'start') /usr/local/bin/apachectl start ;; 'stop') /usr/local/apache/bin/apachectl stop ;; *) echo "Usage: $0 { start | stop }" exit 1 ;; esac exit 0 It should have the following permissions/ownership: -rwxr--r-- root:sys like the other scripts in rc3.d For completeness you could add all the S and K files as hard links: /etc/init.d/myapache /etc/rc0.d/K16myapache /etc/rc1.d/K16myapache /etc/rc2.d/K16myapache /etc/rcS.d/K16myapache >> What unix? Startup scripts seem to be one place where every vendor >> goes their own way. For most SysV type systems I've had good luck >> making init.d/httpd a symlink to apachectl (wherever each of those >> happens to be.) Then the Sxxhttpd in the appropriate runlevel is a >> symlink to init.d/httpd. >> >> More detail depends on the exact OS. > > Hmmm...sorry Steve...it's Solaris OE 8 which is Sun OS 5.8 Apache comes with Solaris 8 Im pretty sure. Maybe you need to get a recent MU and get up to date with patches at sunsolve.sun.com Maybe you could upgrade to Solaris 9 as 10 is right around the corner |
|
|||
|
Thanks Gerry I will try your script...I don't have
/etc/rc3.d/S50myapache; I guess I don't even know enuf to understand where Apache starts from...I guess I thought it started from /usr/local/apache/bin although there is a gigantic apache file in root. Can you give me a brief description of what transpires when apache starts and from where it starts? gerryt@gtconnect.net () wrote in message news:<VATjb.8287$f7.448886@localhost>... > In article <a7bcfd30.0310161322.4eea9d50@posting.google.com >, > david.knight@bell.ca (Dave) writes: > > sgarcia@bak.rr.com (Steve) wrote in message news:<f547625f.0310160943.61756354@posting.google. com>... > >> david.knight@bell.ca (Dave) wrote in message news:<a7bcfd30.0310151126.64038e93@posting.google. com>... > >> > Being new to Unix, and having examined the 3rd edition of Unix System > >> > Admin, I am still having difficulty creating a startup script for > >> > Apache after reboot. I am using /usr/local/apache/bin/apachectl start > >> > and /usr/local/apache/bin/apachectl stop but I am not sure how to make > >> > the script and into what run level it should be entered. > > Newer "Solari" start apache in /etc/rc3.d as S50apache. Lets pretend > for the moment you dont have that?? - which would be a little weird. A > simple script (call it /etc/rc3.d/S50myapache) could go like so: > > #!/sbin/sh > case "$1" in > 'start') > /usr/local/bin/apachectl start > ;; > 'stop') > /usr/local/apache/bin/apachectl stop > ;; > *) > echo "Usage: $0 { start | stop }" > exit 1 > ;; > esac > exit 0 > > It should have the following permissions/ownership: > -rwxr--r-- root:sys > like the other scripts in rc3.d > > For completeness you could add all the S and K files as hard links: > /etc/init.d/myapache > /etc/rc0.d/K16myapache > /etc/rc1.d/K16myapache > /etc/rc2.d/K16myapache > /etc/rcS.d/K16myapache > > >> What unix? Startup scripts seem to be one place where every vendor > >> goes their own way. For most SysV type systems I've had good luck > >> making init.d/httpd a symlink to apachectl (wherever each of those > >> happens to be.) Then the Sxxhttpd in the appropriate runlevel is a > >> symlink to init.d/httpd. > >> > >> More detail depends on the exact OS. > > > > Hmmm...sorry Steve...it's Solaris OE 8 which is Sun OS 5.8 > > Apache comes with Solaris 8 Im pretty sure. Maybe you need to > get a recent MU and get up to date with patches at sunsolve.sun.com > Maybe you could upgrade to Solaris 9 as 10 is right around the corner |
|
|||
|
In article <a7bcfd30.0310200710.2fa3f5b2@posting.google.com >,
david.knight@bell.ca (Dave) top posts: > Thanks Gerry I will try your script...I don't have > /etc/rc3.d/S50myapache; Of course you dont - its not from Sun - it's "yours" hence the "my" If you edit a Sun supplied script it can be overwritten during a patch update or maintenence upgrade. > I guess I don't even know enuf to understand > where Apache starts from...I guess I thought it started from > /usr/local/apache/bin although there is a gigantic apache file in > root. Can you give me a brief description of what transpires when > apache starts and from where it starts? Then you already HAVE Apache installed (the Sun supplied one) It wont start until you create your own httpd.conf. man apache As for what transpires umm try reading through the apachectl script Were it starts depends on which apachectl you evoke. You seem to have two of them. > gerryt@gtconnect.net () wrote in message news:<VATjb.8287$f7.448886@localhost>... >> In article <a7bcfd30.0310161322.4eea9d50@posting.google.com >, >> david.knight@bell.ca (Dave) writes: >> > sgarcia@bak.rr.com (Steve) wrote in message news:<f547625f.0310160943.61756354@posting.google. com>... >> >> david.knight@bell.ca (Dave) wrote in message news:<a7bcfd30.0310151126.64038e93@posting.google. com>... >> >> > Being new to Unix, and having examined the 3rd edition of Unix System >> >> > Admin, I am still having difficulty creating a startup script for >> >> > Apache after reboot. I am using /usr/local/apache/bin/apachectl start >> >> > and /usr/local/apache/bin/apachectl stop but I am not sure how to make >> >> > the script and into what run level it should be entered. >> >> Newer "Solari" start apache in /etc/rc3.d as S50apache. Lets pretend >> for the moment you dont have that?? - which would be a little weird. A >> simple script (call it /etc/rc3.d/S50myapache) could go like so: >> >> #!/sbin/sh >> case "$1" in >> 'start') >> /usr/local/bin/apachectl start >> ;; >> 'stop') >> /usr/local/apache/bin/apachectl stop >> ;; >> *) >> echo "Usage: $0 { start | stop }" >> exit 1 >> ;; >> esac >> exit 0 >> >> It should have the following permissions/ownership: >> -rwxr--r-- root:sys >> like the other scripts in rc3.d >> >> For completeness you could add all the S and K files as hard links: >> /etc/init.d/myapache >> /etc/rc0.d/K16myapache >> /etc/rc1.d/K16myapache >> /etc/rc2.d/K16myapache >> /etc/rcS.d/K16myapache >> >> >> What unix? Startup scripts seem to be one place where every vendor >> >> goes their own way. For most SysV type systems I've had good luck >> >> making init.d/httpd a symlink to apachectl (wherever each of those >> >> happens to be.) Then the Sxxhttpd in the appropriate runlevel is a >> >> symlink to init.d/httpd. >> >> >> >> More detail depends on the exact OS. >> > >> > Hmmm...sorry Steve...it's Solaris OE 8 which is Sun OS 5.8 >> >> Apache comes with Solaris 8 Im pretty sure. Maybe you need to >> get a recent MU and get up to date with patches at sunsolve.sun.com >> Maybe you could upgrade to Solaris 9 as 10 is right around the corner |
|
|||
|
gerryt@gtconnect.net () wrote in message news:<JO0lb.8777$f7.475965@localhost>...
> In article <a7bcfd30.0310200710.2fa3f5b2@posting.google.com >, > david.knight@bell.ca (Dave) top posts: > > Thanks Gerry I will try your script...I don't have > > /etc/rc3.d/S50myapache; > > Of course you dont - its not from Sun - it's "yours" hence the "my" > If you edit a Sun supplied script it can be overwritten > during a patch update or maintenence upgrade. > > > I guess I don't even know enuf to understand > > where Apache starts from...I guess I thought it started from > > /usr/local/apache/bin although there is a gigantic apache file in > > root. Can you give me a brief description of what transpires when > > apache starts and from where it starts? > > Then you already HAVE Apache installed (the Sun supplied one) > It wont start until you create your own httpd.conf. > man apache > > As for what transpires umm try reading through the apachectl script > Were it starts depends on which apachectl you evoke. > You seem to have two of them. Gerry, thanks. No problems running Apache; I installed a non-Sun version from sunfreeware.com and have my own httpd.conf and it's already serving pages, just wanted to fix the after-boot startup thing. Not to lengthen this thread any further, but: 1) I included the script you suggested...does the S50 mean that the script will run before a script that is say S77? 2) Apache does not startup after a reboot even with your script included...is a link required in /etc/init.d? That's where I'll leave this thread...thanks all for your suggestions. Dave > > > gerryt@gtconnect.net () wrote in message news:<VATjb.8287$f7.448886@localhost>... > >> In article <a7bcfd30.0310161322.4eea9d50@posting.google.com >, > >> david.knight@bell.ca (Dave) writes: > >> > sgarcia@bak.rr.com (Steve) wrote in message news:<f547625f.0310160943.61756354@posting.google. com>... > >> >> david.knight@bell.ca (Dave) wrote in message news:<a7bcfd30.0310151126.64038e93@posting.google. com>... > >> >> > Being new to Unix, and having examined the 3rd edition of Unix System > >> >> > Admin, I am still having difficulty creating a startup script for > >> >> > Apache after reboot. I am using /usr/local/apache/bin/apachectl start > >> >> > and /usr/local/apache/bin/apachectl stop but I am not sure how to make > >> >> > the script and into what run level it should be entered. > >> > >> Newer "Solari" start apache in /etc/rc3.d as S50apache. Lets pretend > >> for the moment you dont have that?? - which would be a little weird. A > >> simple script (call it /etc/rc3.d/S50myapache) could go like so: > >> > >> #!/sbin/sh > >> case "$1" in > >> 'start') > >> /usr/local/bin/apachectl start > >> ;; > >> 'stop') > >> /usr/local/apache/bin/apachectl stop > >> ;; > >> *) > >> echo "Usage: $0 { start | stop }" > >> exit 1 > >> ;; > >> esac > >> exit 0 > >> > >> It should have the following permissions/ownership: > >> -rwxr--r-- root:sys > >> like the other scripts in rc3.d > >> > >> For completeness you could add all the S and K files as hard links: > >> /etc/init.d/myapache > >> /etc/rc0.d/K16myapache > >> /etc/rc1.d/K16myapache > >> /etc/rc2.d/K16myapache > >> /etc/rcS.d/K16myapache > >> > >> >> What unix? Startup scripts seem to be one place where every vendor > >> >> goes their own way. For most SysV type systems I've had good luck > >> >> making init.d/httpd a symlink to apachectl (wherever each of those > >> >> happens to be.) Then the Sxxhttpd in the appropriate runlevel is a > >> >> symlink to init.d/httpd. > >> >> > >> >> More detail depends on the exact OS. > >> > > >> > Hmmm...sorry Steve...it's Solaris OE 8 which is Sun OS 5.8 > >> > >> Apache comes with Solaris 8 Im pretty sure. Maybe you need to > >> get a recent MU and get up to date with patches at sunsolve.sun.com > >> Maybe you could upgrade to Solaris 9 as 10 is right around the corner |
|
|||
|
In article <a7bcfd30.0310210701.49cd1a37@posting.google.com >,
david.knight@bell.ca (Dave) top posts (again): > gerryt@gtconnect.net () wrote in message news:<JO0lb.8777$f7.475965@localhost>... >> In article <a7bcfd30.0310200710.2fa3f5b2@posting.google.com >, >> david.knight@bell.ca (Dave) top posts: >> > Thanks Gerry I will try your script...I don't have >> > /etc/rc3.d/S50myapache; >> >> Of course you dont - its not from Sun - it's "yours" hence the "my" >> If you edit a Sun supplied script it can be overwritten >> during a patch update or maintenence upgrade. >> >> > I guess I don't even know enuf to understand >> > where Apache starts from...I guess I thought it started from >> > /usr/local/apache/bin although there is a gigantic apache file in >> > root. Can you give me a brief description of what transpires when >> > apache starts and from where it starts? >> >> Then you already HAVE Apache installed (the Sun supplied one) >> It wont start until you create your own httpd.conf. >> man apache >> >> As for what transpires umm try reading through the apachectl script >> Were it starts depends on which apachectl you evoke. >> You seem to have two of them. > > Gerry, thanks. No problems running Apache; I installed a non-Sun > version from sunfreeware.com and have my own httpd.conf and it's > already serving pages, just wanted to fix the after-boot startup > thing. Not to lengthen this thread any further, but: > > 1) I included the script you suggested...does the S50 mean that the > script will run before a script that is say S77? Indeed. > 2) Apache does not startup after a reboot even with your script > included...is a link required in /etc/init.d? No link required. My example assumed that apachectl exists in /usr/local/bin and that SFW distributes it. Change the top line to: #!/sbin/sh -x (add the -x) and run the script like so: /etc/rc3.d/S50myapache start What happens? If I were you I'd consider using the packages from www.blastwave.org over Sunfreeware. > That's where I'll leave this thread...thanks all for your suggestions. > Dave > >> >> > gerryt@gtconnect.net () wrote in message news:<VATjb.8287$f7.448886@localhost>... >> >> In article <a7bcfd30.0310161322.4eea9d50@posting.google.com >, >> >> david.knight@bell.ca (Dave) writes: >> >> > sgarcia@bak.rr.com (Steve) wrote in message news:<f547625f.0310160943.61756354@posting.google. com>... >> >> >> david.knight@bell.ca (Dave) wrote in message news:<a7bcfd30.0310151126.64038e93@posting.google. com>... >> >> >> > Being new to Unix, and having examined the 3rd edition of Unix System >> >> >> > Admin, I am still having difficulty creating a startup script for >> >> >> > Apache after reboot. I am using /usr/local/apache/bin/apachectl start >> >> >> > and /usr/local/apache/bin/apachectl stop but I am not sure how to make >> >> >> > the script and into what run level it should be entered. >> >> >> >> Newer "Solari" start apache in /etc/rc3.d as S50apache. Lets pretend >> >> for the moment you dont have that?? - which would be a little weird. A >> >> simple script (call it /etc/rc3.d/S50myapache) could go like so: >> >> >> >> #!/sbin/sh >> >> case "$1" in >> >> 'start') >> >> /usr/local/bin/apachectl start >> >> ;; >> >> 'stop') >> >> /usr/local/apache/bin/apachectl stop >> >> ;; >> >> *) >> >> echo "Usage: $0 { start | stop }" >> >> exit 1 >> >> ;; >> >> esac >> >> exit 0 >> >> >> >> It should have the following permissions/ownership: >> >> -rwxr--r-- root:sys >> >> like the other scripts in rc3.d >> >> >> >> For completeness you could add all the S and K files as hard links: >> >> /etc/init.d/myapache >> >> /etc/rc0.d/K16myapache >> >> /etc/rc1.d/K16myapache >> >> /etc/rc2.d/K16myapache >> >> /etc/rcS.d/K16myapache >> >> >> >> >> What unix? Startup scripts seem to be one place where every vendor >> >> >> goes their own way. For most SysV type systems I've had good luck >> >> >> making init.d/httpd a symlink to apachectl (wherever each of those >> >> >> happens to be.) Then the Sxxhttpd in the appropriate runlevel is a >> >> >> symlink to init.d/httpd. >> >> >> >> >> >> More detail depends on the exact OS. >> >> > >> >> > Hmmm...sorry Steve...it's Solaris OE 8 which is Sun OS 5.8 >> >> >> >> Apache comes with Solaris 8 Im pretty sure. Maybe you need to >> >> get a recent MU and get up to date with patches at sunsolve.sun.com >> >> Maybe you could upgrade to Solaris 9 as 10 is right around the corner |
|
|||
|
Gerry I finally got your original script to work using a link instead
of making the changes you state at "#!/sbin/sh -x" below. Here is what I did: I placed your script as /etc/init.d/apacheautostart I made ln -s /etc/init.d/apacheautostart /etc/rc3.d/S99apacheautostart I made ln -s /etc/init.d/apacheautostart /etc/rc0.d/K03apacheautostart Logging on from the console and entering init 6, I see that Apache is the first process to stop and, upon reboot, is the last process to start. Perfect! I posted this because it seems that this is a topic that I see a lot of in this newsgroup....maybe it'll help others. THANKS. gerryt@gtconnect.net () wrote in message news:<Uxclb.8875$f7.479643@localhost>... > In article <a7bcfd30.0310210701.49cd1a37@posting.google.com >, > david.knight@bell.ca (Dave) top posts (again): > > > gerryt@gtconnect.net () wrote in message news:<JO0lb.8777$f7.475965@localhost>... > >> In article <a7bcfd30.0310200710.2fa3f5b2@posting.google.com >, > >> david.knight@bell.ca (Dave) top posts: > >> > Thanks Gerry I will try your script...I don't have > >> > /etc/rc3.d/S50myapache; > >> > >> Of course you dont - its not from Sun - it's "yours" hence the "my" > >> If you edit a Sun supplied script it can be overwritten > >> during a patch update or maintenence upgrade. > >> > >> > I guess I don't even know enuf to understand > >> > where Apache starts from...I guess I thought it started from > >> > /usr/local/apache/bin although there is a gigantic apache file in > >> > root. Can you give me a brief description of what transpires when > >> > apache starts and from where it starts? > >> > >> Then you already HAVE Apache installed (the Sun supplied one) > >> It wont start until you create your own httpd.conf. > >> man apache > >> > >> As for what transpires umm try reading through the apachectl script > >> Were it starts depends on which apachectl you evoke. > >> You seem to have two of them. > > > > Gerry, thanks. No problems running Apache; I installed a non-Sun > > version from sunfreeware.com and have my own httpd.conf and it's > > already serving pages, just wanted to fix the after-boot startup > > thing. Not to lengthen this thread any further, but: > > > > 1) I included the script you suggested...does the S50 mean that the > > script will run before a script that is say S77? > > Indeed. > > > 2) Apache does not startup after a reboot even with your script > > included...is a link required in /etc/init.d? > > No link required. My example assumed that apachectl exists in > /usr/local/bin and that SFW distributes it. > Change the top line to: > #!/sbin/sh -x > (add the -x) and run the script like so: > /etc/rc3.d/S50myapache start > What happens? > > If I were you I'd consider using the packages from > www.blastwave.org over Sunfreeware. > > > That's where I'll leave this thread...thanks all for your suggestions. > > Dave > > > >> > >> > gerryt@gtconnect.net () wrote in message news:<VATjb.8287$f7.448886@localhost>... > >> >> In article <a7bcfd30.0310161322.4eea9d50@posting.google.com >, > >> >> david.knight@bell.ca (Dave) writes: > >> >> > sgarcia@bak.rr.com (Steve) wrote in message news:<f547625f.0310160943.61756354@posting.google. com>... > >> >> >> david.knight@bell.ca (Dave) wrote in message news:<a7bcfd30.0310151126.64038e93@posting.google. com>... > >> >> >> > Being new to Unix, and having examined the 3rd edition of Unix System > >> >> >> > Admin, I am still having difficulty creating a startup script for > >> >> >> > Apache after reboot. I am using /usr/local/apache/bin/apachectl start > >> >> >> > and /usr/local/apache/bin/apachectl stop but I am not sure how to make > >> >> >> > the script and into what run level it should be entered. > >> >> > >> >> Newer "Solari" start apache in /etc/rc3.d as S50apache. Lets pretend > >> >> for the moment you dont have that?? - which would be a little weird. A > >> >> simple script (call it /etc/rc3.d/S50myapache) could go like so: > >> >> > >> >> #!/sbin/sh > >> >> case "$1" in > >> >> 'start') > >> >> /usr/local/bin/apachectl start > >> >> ;; > >> >> 'stop') > >> >> /usr/local/apache/bin/apachectl stop > >> >> ;; > >> >> *) > >> >> echo "Usage: $0 { start | stop }" > >> >> exit 1 > >> >> ;; > >> >> esac > >> >> exit 0 > >> >> > >> >> It should have the following permissions/ownership: > >> >> -rwxr--r-- root:sys > >> >> like the other scripts in rc3.d > >> >> > >> >> For completeness you could add all the S and K files as hard links: > >> >> /etc/init.d/myapache > >> >> /etc/rc0.d/K16myapache > >> >> /etc/rc1.d/K16myapache > >> >> /etc/rc2.d/K16myapache > >> >> /etc/rcS.d/K16myapache > >> >> > >> >> >> What unix? Startup scripts seem to be one place where every vendor > >> >> >> goes their own way. For most SysV type systems I've had good luck > >> >> >> making init.d/httpd a symlink to apachectl (wherever each of those > >> >> >> happens to be.) Then the Sxxhttpd in the appropriate runlevel is a > >> >> >> symlink to init.d/httpd. > >> >> >> > >> >> >> More detail depends on the exact OS. > >> >> > > >> >> > Hmmm...sorry Steve...it's Solaris OE 8 which is Sun OS 5.8 > >> >> > >> >> Apache comes with Solaris 8 Im pretty sure. Maybe you need to > >> >> get a recent MU and get up to date with patches at sunsolve.sun.com > >> >> Maybe you could upgrade to Solaris 9 as 10 is right around the corner |
| Thread Tools | |
| Display Modes | |
|
|