httpd的安装的启动脚本的制作,2024大厂Android面试最火问题

安装 apache压缩

把下载下来的包放在 /usr/local/src 下,使用 tar zxvf httpd-NN.tar.gz解压,

cd httpd-NN

./configure --prefix=/usr/local/httpd

make

make install

现在你发现在/usr/local下面多出了一个httpd的目录

我们可以利用 /usr/local/httpd/bin/apachectl -k start|stop|restart 来管理httpd服务。

如果要随系统启动,我们必须在 /etc/rc.d/init.d/rc.local文件的末尾加上一行:

/usr/local/httpd/bin/apachectl -k start

即使是这样,但是我们还是不方便管理httpd服务,我们能不能,像rpm安装那样使用service服务来管理httpd服务呢?

答案是肯定的我们必须如下操作:

在 /etc/rc.d/init.d/下建立一个 httpd的文件,利用 chmod 755 httpd 使其具有执行能力。

vi httpd 添加如下内容:

#!/bin/bash

httpd Startup script for the Apache HTTP Server

chkconfig: - 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/functions

if [ -f /etc/sysconfig/httpd ]; then

. /etc/sysconfig/httpd

fi

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 will refuse to start.

Path to the apachectl script, server binary, and short-form for messages.

apachectl=/usr/sbin/apachectl

httpd=${HTTPD-/usr/sbin/httpd}

prog=httpd

pidfile=${PIDFILE-/var/run/httpd.pid}

lockfile=${LOCKFILE-/var/lock/subsys/httpd}

RETVAL=0

check for 1.3 configuration

check13 () {

CONFFILE=/etc/httpd/conf/httpd.conf

GONE=“(ServerType|BindAddress|Port|AddModule|ClearModuleList|”

GONE=“${GONE}AgentLog|RefererLog|RefererIgnore|FancyIndexing|”

GONE=“${GONE}AccessConfig|ResourceConfig)”

if LANG=C grep -Eiq “1*($GONE)” $CONFFILE; then

echo

echo 1>&2 " Apache 1.3 configuration directives found"

echo 1>&2 " please read /usr/share/doc/httpd-2.2.3/migration.html"

failure “Apache 1.3 config directives test”

echo

exit 1

fi

}

The semantics of these two functions differ from the way apachectl does

things – attempting to start while running is a failure, and shutdown

when not running is also a failure. So we just do it the way init scripts

are expected to behave here.

start() {

自我介绍一下,小编13年上海交大毕业,曾经在小公司待过,也去过华为、OPPO等大厂,18年进入阿里一直到现在。

深知大多数初中级安卓工程师,想要提升技能,往往是自己摸索成长,但自己不成体系的自学效果低效又漫长,而且极易碰到天花板技术停滞不前!

因此收集整理了一份《2024年最新Android移动开发全套学习资料》送给大家,初衷也很简单,就是希望能够帮助到想自学提升又不知道该从何学起的朋友,同时减轻大家的负担。
img
img
img
img

由于文件比较大,这里只是将部分目录截图出来,每个节点里面都包含大厂面经、学习笔记、源码讲义、实战项目、讲解视频
如果你觉得这些内容对你有帮助,可以添加下面V无偿领取!(备注Android)
img

学习分享,共勉

Android高级架构师进阶之路

题外话,我在阿里工作多年,深知技术改革和创新的方向,Android开发以其美观、快速、高效、开放等优势迅速俘获人心,但很多Android兴趣爱好者所需的进阶学习资料确实不太系统,完整。今天我把我搜集和整理的这份学习资料分享给有需要的人,若有关Android学习进阶可以与我在Android终极开发交流群一起讨论交流。 点击这里前往我的Git领取资料 的同时,还可以加入一个好的学习交流圈,何乐而不为呢?加入我们和我们一起吧!!

  • Android进阶知识体系学习脑图

  • Android进阶高级工程师学习全套手册

  • 对标Android阿里P7,年薪50w+学习视频

  • 大厂内部Android高频面试题,以及面试经历

  • Android进阶高级工程师学习全套手册

[外链图片转存中…(img-gsNwFUGB-1710662878107)]

  • 对标Android阿里P7,年薪50w+学习视频

[外链图片转存中…(img-RivxfWM6-1710662878108)]

  • 大厂内部Android高频面试题,以及面试经历


  1. [:space:] ↩︎

  • 17
    点赞
  • 10
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值