ljohn_ops常用腳本集合帖

ljohn_ops

常用的腳本集合

集合中包含各種服務的創建,性能測試,日常巡檢等;腳本大部分是自己工作中編寫使用(經過嚴格測試),還包含一些運維大鳥寫的腳本修改而來。
項目地址:https://github.com/Ljohn001/ljohn_ops

一.腳本列表

更新內容 描述 更新時間
backup 文件目錄備份 2018.1.9
mysql mysql備份及重設root用戶密碼 2017.12.28
chk_url 網站url 檢查腳本 2017.12.26
process-monitor 進程監控腳本 2018.1.9
cobbler Cobbler無人值守,自動化部署系統 2017.11.28
polling 輪詢巡檢腳本 2017.10.10
shells 常用小腳本集合 2017.10.28
chkhosts 主機ping 檢測腳本 2017.09.28
disk 自動磁盤分區scripts 2017.09.28
ftp FTP Upload/Download 2017.09.28
linux-init linux 最小化安裝初始化及服務器SysV Init scripts 2017.09.28
lnmp lnmp scripts 2017.10.28
network 網絡配置,centos7 返回eth0 接口名,雙網卡綁定 2018.1.10
redis redis 部署腳本 2017.09.28
*** open***/pptp scripts 2017.9.25

二.使用場景

如何在運維重複的勞動中解脫出來?如何才能提高運維的效率?如何實現喝個茶時間,服務就能上線?

舉個栗子:

A(開發Dev):幫我部署個服務nginx,apache,redis....

B(運維Ops): 好的,然後登陸機器,不停的敲打鍵盤,10分鐘甚至30分鐘部署完。

C(運維Ops):
只要登陸機器,一條命令執行:

curl -sSL https://raw.githubusercontent.com/Ljohn001/ljohn_ops/master/redis/redis3.x.sh|sh -

出去泡個茶,回來服務部署好了。

三.下載使用

1、項目Git 下載:

git clone https://github.com/Ljohn001/ljohn_ops.git

2、單獨下載某一個腳本。

wget  URL
curl -O URL
示例:
# wget http://raw.githubusercontent.com/Ljohn001/ljohn_ops/master/redis/redis3.x.sh
# curl -O  https://raw.githubusercontent.com/Ljohn001/ljohn_ops/master/redis/redis3.x.sh

四.curl 遠程執行腳本:

curl -sSL https://XXXXXXX.sh |sh -
-s, --silent
              Silent or quiet mode. Don't show progress meter or error messages.  Makes Curl mute.
S, --show-error 
When used with -s it makes curl show an error message if it fails.
-L, --location
示例:

系統:CentOS5/6/7/RHEL5/6/7

1.查看Linux系統基本信息(CPU,內存,磁盤,網絡)
```
# curl -sSL https://raw.githubusercontent.com/Ljohn001/ljohn_ops/master/shells/system_info_colour.sh|sh -
```

2.自動安裝redis3.x
```
# curl -sSL https://raw.githubusercontent.com/Ljohn001/ljohn_ops/master/redis/redis3.x.sh|sh -
```

3.自動磁盤分區(添加磁盤後執行如下命令)
```
# curl -sSL  https://github.com/Ljohn001/ljohn_ops/blob/master/disk/auto_disk.sh|sh -
```

4.一鍵測試(服務器性能[IO/Disk/Network/CPU])

原項目github地址:
https://github.com/teddysun/across/blob/master/bench.sh

使用方法:https://teddysun.com/444.html
```
# curl -Lso- https://raw.githubusercontent.com/Ljohn001/across/master/bench.sh |bash

或者

# curl -sSL https://raw.githubusercontent.com/Ljohn001/ljohn_ops/master/shells/system_chk.sh|sh

```

5.安裝YUM源

```
#支持CentOS5/6/7
# curl -sSL https://raw.githubusercontent.com/Ljohn001/ljohn_ops/master/shells/repo.sh|sh -
```

6.配置環境變量
```
# curl -sSL https://raw.githubusercontent.com/Ljohn001/ljohn_ops/master/shells/ljohn.sh |sh -
```

7.簡單磁盤IO測試
```
#IO 測試三次,並顯示平均值。
#curl -sSL https://raw.githubusercontent.com/Ljohn001/ljohn_ops/master/shells/io_test.sh |sh
```

8.Linux 最小化安裝初始化系統

  #CentOS6.x下執行:
  #curl -sSL https://raw.githubusercontent.com/Ljohn001/ljohn_ops/master/linux-init/centos6_init.sh|sh -

  #CentOS7.x下執行:
  #curl -sSL https://raw.githubusercontent.com/Ljohn001/ljohn_ops/master/linux-init/centos7_init.sh|sh -

歡迎大家來批評指正,聯繫方式

QQ:184694637

Mail: [email protected]

Blog:https://blog.51cto.com/ljohn

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章