Shell指令碼 一鍵優化系統指令碼

2021-10-11 02:06:31 字數 580 閱讀 9171

作為舉例,只是優化了幾個方面,如果想加入其他內容需要自己在編寫模組。

指令碼內容:

#!/bin/bash

export path=$path:/bin:/sbin:/usr/sbinif[

"$uid"

!= "0"

];then

echo

"please run this script by root."

exit 1

fifunction mod_yum(

)function close_selinux(

)function close_iptables(

)function least_service()'

|bash

chkconfig|egrep "crond|sshd|network|rsyslog|sysstat"

|awk ''

|bash

}function update_linux(

)main(

)main

每乙個模組實現乙個功能,如果想要其他的功能,在main上一行繼續按格式新增即可。

shell指令碼一鍵安裝zabbix

bin bash zabbix 一鍵部署指令碼 echo 正在配置firewall防火牆 systemctl stop firewalld dev null systemctl disable firewalld dev null if eq 0 then echo firewall防火牆初始化完畢...

shell指令碼一鍵安裝lnmp

bin bash 安裝nginx依賴 yum y install gcc gcc c pcre devel zlib devel openssl devel 解壓nginx安裝包 tar zxf nginx 1.12.2.tar.gz cd nginx 1.12.2 編譯安裝 configure m...

shell指令碼一鍵部署LNMP

author create date 2020 07 15 01 52 version mail description bin bash mysql的原始碼安裝 read p 即將進行mysql原始碼安裝,請問是否進行 y n speed case speed in y mysqld yes my...