zoukankan      html  css  js  c++  java
  • N46期第四周作业

    第四周作业:

     1. 计算 100 以内所有能被 3 整除的整数之和

     2. 编写脚本,求 100 以内所有正奇数之和

    3. 随机生成 10 以内的数字,实现猜字游戏,提示比较大或小,相等则退出

    4. 编写函数,实现两个数字做为参数,返回最大值

    5. 编写一个httpd安装脚本

    #!/bin/bash

    #Create DIRs

    mkdir -p /apps/httpd;mkdir -p /etc/httpd

    #Disable Firewalld & SElinux

    systemctl disable --now firewalld
    sed -i.bak 's/SELINUX=enforcing/SELINUX=disabled/' /etc/selinux/config

    #Set Variables
    URL="http://apache.mirror.serversaustralia.com.au/httpd/httpd-2.4.43.tar.bz2"
    PACKAGE="httpd-2.4.43"
    APPDIR=/apps/httpd
    CONFIGDIR=/etc/httpd
    #Install Dependencies
    echo "Installing Dependencies, please wait!"
    yum -y install wget gcc make autoconf ncurses-devel bzip2 apr-devel apr-util-devel pcre-devel openssl-devel &> /dev/null
    if [ $? -eq 0 ]; then
    echo "Installaion Succeed!"
    else
    echo "Installation Failure!"
    exit 1
    fi
    echo "Installing and Taring!"
    wget $URL &> /dev/null &&
    tar xvf $PACKAGE.tar.bz2 -C /usr/local/src &> /dev/null
    echo "Make and Install..."
    cd /usr/local/src/$PACKAGE
    ./configure --prefix=$APPDIR --sysconfdir=$CONFIGDIR --enable-ssl
    make -j 4 && make install
    if [ $? -eq 0 ]; then
    echo "Make Install Succeed!"
    else
    echo "Make Install Failure!"
    exit 1
    fi
    sleep 3
    echo "Config Env PATH"
    echo "PATH=$APPDIR/bin/:$PATH" > /etc/profile.d/httpd.sh
    source /etc/profile.d/httpd.sh
    echo "set apache as default user"
    sed -i.bak 's/User daemon/User apache/;s/Group daemon/Group apache/' $CONFIGDIR/httpd.conf
    id apache &> /dev/null
    if [ $? -eq 0 ]; then
    apachectl start
    else
    useradd -r -s /sbin/nologin -d /var/www -c Apache -u 66 apache && apachectl start
    fi
    echo "Check Process and Test"
    ps -ef | grep httpd && curl 10.0.0.201

  • 相关阅读:
    Poj(1703),种类并查集
    Poj(2236),简单并查集
    Poj (3239),m皇后问题
    Poj(1521),哈夫曼编码
    NYOJ(680),摘枇杷,(暴力,或者二分搜索)
    NYOJ(42)欧拉图
    数集合有多少个TOJ(2469)
    HDU(1016),打素数环
    HDU(4394),数论上的BFS
    Poj(2225),三维BFS
  • 原文地址:https://www.cnblogs.com/davidwang1970/p/13178996.html
Copyright © 2011-2022 走看看