First attempt to use script to automatically build lamp-----Apache

Source: Internet
Author: User

When the boot script is imported later, it seems to be an error, causing the service to not start, have not found what is going on

#! /bin/bash#echo  "apache installing ..." yum -y groupinstall  ' Compatibility  Libraries '   ' development tools ' yum -y installncurses-devel openssl*echo  ' Apr  & apr-util&nbsp "read -p " please input compress type[bz2|gz]:  " COMPRESSread -p " please input a apr version[apr-"VERSION". Tar. $COMPRESS]:    APRVERwhile ! echo  $APRVER  | grep  [![:alpha:]]*  &>  /dev/null ; doread -p  "please input a apr version[apr-" version. Tar. $COMPRESS]:  " APRVERdoneread -p " please input a apr-util version[ apr-util-"VERSION". Tar. $COMPRESS]:  " APRUTILVERwhile ! echo  $APRUTILVER  |  grep  "[![:alpha:]]*"  &> /dev/null ; doread -p  "Please input  a apr version[apr-util-"VERSION". Tar. $COMPRESS]:  " aprutilverdonetar -xf apr-${aprver}.tar. $COMPRESSCD  apr-${APRVER}./configure --prefix=/usr/local/aprmake && make installcd  -tar -xf apr-util-${aprutilver}.tar. $COMPRESSCD  apr-util-${aprutilver}./configure --prefix =/usr/local/apr-util --with-apr=/usr/local/aprmake && make installcd -echo   "httpd&nbsp ..." read -p  "please input compress type[bz2|gz]: "   compressread -p  "please input a httpd version[httpd-" VERSION ". Tar. $COMPRESS]:    HTTPDVERwhile ! echo  $HTTPDVER  | grep  [![:alpha:]]*  & > /dev/null ; doread -p  "please input a apr version[apr-util-" VERSION ". Tar. $COMPRESS]: "  aprutilverdonetar -xf httpd-${httpdver}.tar $COMPRESScd   httpd-${httpdver}./configure --prefix=/usr/local/apache --sysconfdir=/etc/httpd --enable-so --enable-ssl -- enable-cgi --enable-rewrite --with-zlib --with-pcre --with-apr=/usr/local/apr -- with-apr-util=/usr/local/apr-util --enable-modules=most --enable-mpms-shared=all --with-mpm= eventmake && make installcd -cat << eof >> /etc/ httpd/httpd.confpidfile  "/var/run/httpd.pid" eofcat << eof > /etc/init.d/ Httpd#!/bin/bash## httpd        startup script for  the apache http server## chkconfig: 345 85 15# description:  apache is a world wide web server.  it is used to  serve #          HTML files and  Cgi.# processname: httpd# config: /etc/httpd/conf/httpd.conf# config: /etc/sysconfig/httpd# pidfile: /var/run/ Httpd.pid# source function library.  /etc/rc.d/init.d/functionsif [ -f /etc/sysconfig/httpd ]; then         . /etc/sysconfig/httpdfi# start httpd in the  c locale by default. httpd_lang=${httpd_lang-"C"}# this will prevent initlog from swallowing up  a pass-phrase prompt if# mod_ssl needs a pass-phrase from  The user. Initlog_args= "" # set httpd=/usr/sbin/httpd.worker in /etc/sysconfig/httpd to use  a server# with the thread-based  "Worker"  MPM; BE WARNED  That some modules may not# work correctly with a thread-based  mpm; notably php&nbsP;will refuse to start.# path to the apachectl script, server  binary, and short-form for messages.apachectl=/usr/local/apache/bin/apachectlhttpd=$ {httpd-/usr/local/apache/bin/httpd}prog=httpdpidfile=${pidfile-/var/run/httpd.pid}lockfile=${lockfile-/var/ Lock/subsys/httpd}retval=0start ()  {        echo -n $ " starting  $prog:  "        lang= $HTTPD _lang daemon - -pidfile=${pidfile}  $httpd   $OPTIONS         RETVAL=$?         echo        [  $RETVAL  = 0 ] && touch ${lockfile}         return  $RETVAL}stop ()  {    echo -n $ "stopping  $prog: "     killproc -p ${pidfile} -d 10  $httpd     RETVAL=$?     echo    [  $RETVAL  = 0 ] && rm -f ${ Lockfile} ${pidfile}}reload ()  {    echo -n $ "Reloading  $prog:   "    if ! lang= $HTTPD _lang  $httpd   $OPTIONS  -t > &/dev/null; then        RETVAL=$?         echo $ "not reloading due to configuration syntax  Error "        failure $" not reloading  $httpd  due  to configuration syntax error "    else         killproc -p ${pidfile}  $httpd  -HUP         retval=$?    fi    echo}# see how we were called.case  "$"  in  start)     start    ;;   stop)     stop    ;;   status)         status -p ${pidfile}  $httpd     RETVAL=$?    ;;   restart)     stop    start    ;;   condrestart)     if [ -f ${pidfile} ] ; then         stop        start     fi    ;;   reload)         reload    ;;   graceful|help|configtest|fullstatus)      $apachectl  [email protected]    retval=$?    ;;   *)     echo $ "usage:  $prog  {start|stop|restart|condrestart| Reload|status|fullstatus|graceful|help|configtest} "    exit 1esacexit $ retvaleofchmod +x /etc/init.d/httpdchkconf --add httpdecho  "Apach Install  Succeeful "


First attempt to use script to automatically build lamp-----Apache

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.