阿里云的一个安装脚本

#!/bin/bash

if [ `uname -m` = "x86_64" ]; then
    ARCH="linux64"
else
    ARCH="linux32"
fi

AEGIS_UPDATE_SITE="http://update.aegis.aliyun.com/download"
AEGIS_INSTALL_DIR="/usr/local/aegis"

install_aegis() {
    killall -9 aegis_update
    killall -9 aegis_cli
    if [ -d ${AEGIS_INSTALL_DIR} ];then
        rm -rf ${AEGIS_INSTALL_DIR}
    fi
    mkdir -p "${AEGIS_INSTALL_DIR}/aegis_client"
    mkdir -p "${AEGIS_INSTALL_DIR}/aegis_update"

   
    wget "${AEGIS_UPDATE_SITE}/$ARCH/update_00_06/aegis_update" -O "${AEGIS_INSTALL_DIR}/aegis_update/aegis_update" -T 120
    if [ $? != 0 ]; then
        echo "wget aegis_update error" 1>&2
        exit 1
    fi
    wget "${AEGIS_UPDATE_SITE}/$ARCH/update_00_06/agx_update.cfg" -O "${AEGIS_INSTALL_DIR}/aegis_update/agx_update.cfg" -T 120
    if [ $? != 0 ]; then
        echo "wget agx_update.cfg error" 1>&2
        exit 1
    fi
   
    chmod +x "${AEGIS_INSTALL_DIR}/aegis_update/aegis_update"
    echo "aegis_00_19" > ${AEGIS_INSTALL_DIR}/aegis_update/up_cmd.txt
}

install_service(){
    wget "${AEGIS_UPDATE_SITE}/aegis" -O /etc/init.d/aegis
    if [ $? != 0 ]; then
        echo "wget aegis error" 1>&2
        exit 1
    fi
   
    chmod +x /etc/init.d/aegis

    rm -f /etc/rc2.d/S80aegis
    rm -f /etc/rc3.d/S80aegis
    rm -f /etc/rc4.d/S80aegis
    rm -f /etc/rc5.d/S80aegis

    ln -s /etc/init.d/aegis /etc/rc2.d/S80aegis >/dev/null 2>&1
    ln -s /etc/init.d/aegis /etc/rc3.d/S80aegis >/dev/null 2>&1
    ln -s /etc/init.d/aegis /etc/rc4.d/S80aegis >/dev/null 2>&1
    ln -s /etc/init.d/aegis /etc/rc5.d/S80aegis >/dev/null 2>&1
}

uninstall_service() {
    rm -f /etc/init.d/aegis
    rm -f /etc/rc2.d/S80aegis
    rm -f /etc/rc3.d/S80aegis
    rm -f /etc/rc4.d/S80aegis
    rm -f /etc/rc5.d/S80aegis
}

if [ `id -u` -ne "0" ]; then
    echo "ERROR: This script must be run as root." 1>&2
    exit 1
fi

install_aegis
install_service
service aegis start

echo "Aegis install successful"
exit 0
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值