. upgrade.sh php,upgrade.sh

#!/usr/bin/env bash

# Copyright (C) 2013 - 2021 Teddysun

#

# This file is part of the LAMP script.

#

# LAMP is a powerful bash script for the installation of

# Apache + PHP + MySQL/MariaDB and so on.

# You can install Apache + PHP + MySQL/MariaDB in an very easy way.

# Just need to input numbers to choose what you want to install before installation.

# And all things will be done in a few minutes.

#

# Website: https://lamp.sh

# Github: https://github.com/teddysun/lamp

PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin

export PATH

cur_dir=$(cd -P -- "$(dirname -- "$0")" && pwd -P)

include(){

local include=$1

if [[ -s ${cur_dir}/include/${include}.sh ]];then

. ${cur_dir}/include/${include}.sh

else

echo "Error:${cur_dir}/include/${include}.sh not found, shell can not be executed."

exit 1

fi

}

upgrade_menu(){

echo

echo "+-------------------------------------------------------------------+"

echo "| Auto Update LAMP(Linux + Apache + MySQL/MariaDB + PHP ) |"

echo "| Website: https://lamp.sh |"

echo "| Author : Teddysun |"

echo "+-------------------------------------------------------------------+"

echo

while true

do

_info "$(_green 1). Upgrade Apache"

_info "$(_green 2). Upgrade MySQL or MariaDB"

_info "$(_green 3). Upgrade PHP"

_info "$(_green 4). Upgrade phpMyAdmin"

_info "$(_green 5). Upgrade Adminer"

_info "$(_green 6). Exit"

echo

read -p "Please input a number: " number

if [[ ! ${number} =~ ^[1-6]$ ]]; then

_error "Input error, please only input 1~6"

else

case "${number}" in

1)

upgrade_apache 2>&1 | tee ${cur_dir}/upgrade_apache.log

break

;;

2)

upgrade_db 2>&1 | tee ${cur_dir}/upgrade_db.log

break

;;

3)

upgrade_php 2>&1 | tee ${cur_dir}/upgrade_php.log

break

;;

4)

upgrade_phpmyadmin 2>&1 | tee ${cur_dir}/upgrade_phpmyadmin.log

break

;;

5)

upgrade_adminer 2>&1 | tee ${cur_dir}/upgrade_adminer.log

break

;;

6)

exit

;;

esac

fi

done

}

display_usage(){

printf "

Usage: $0 [ apache | db | php | phpmyadmin | adminer ]

apache --->Upgrade Apache

db --->Upgrade MySQL or MariaDB

php --->Upgrade PHP

phpmyadmin --->Upgrade phpMyAdmin

adminer --->Upgrade Adminer

"

}

include config

include public

include php-modules

include upgrade_apache

include upgrade_db

include upgrade_php

include upgrade_phpmyadmin

include upgrade_adminer

load_config

rootness

if [ ${#} -eq 0 ]; then

upgrade_menu

elif [ ${#} -eq 1 ]; then

case $1 in

apache)

upgrade_apache 2>&1 | tee ${cur_dir}/upgrade_apache.log

;;

db)

upgrade_db 2>&1 | tee ${cur_dir}/upgrade_db.log

;;

php)

upgrade_php 2>&1 | tee ${cur_dir}/upgrade_php.log

;;

phpmyadmin)

upgrade_phpmyadmin 2>&1 | tee ${cur_dir}/upgrade_phpmyadmin.log

;;

adminer)

upgrade_adminer 2>&1 | tee ${cur_dir}/upgrade_adminer.log

;;

*)

display_usage

;;

esac

else

display_usage

fi

一键复制

编辑

Web IDE

原始数据

按行查看

历史

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值