shell鍛戒护2

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了shell鍛戒护2相关的知识,希望对你有一定的参考价值。

鏍囩锛?a href='http://www.mamicode.com/so/1/raid5' title='raid5'>raid5   绀轰緥   linux姝e垯   mac   xxx   div   澶勭悊宸ュ叿   raid   ip鍦板潃   

raid0 raid1 raid5鐨勫尯鍒?/span>

# 1銆佷粈涔堟槸raid锛?/span>
鐢变竴绯诲垪纭洏缁勬垚鐨勯樀鍒?绠€鍗曡:涓€涓湇鍔″櫒鏈?0涓竴纭洏,浣犲浣曡兘淇濊瘉鍧忔帀1涓‖鐩樺悗鏁版嵁涓嶄涪,涓氬姟涓嶆柇

# raid鍒嗙被:raid0 銆乺aid1銆乺aid5
raid0
  1銆佺壒鐐?鏁版嵁鍒嗘暎瀛樺偍鍦ㄥ涓‖鐩?
  2銆佷紭鐐?璇诲啓骞跺彂,閫熷害瓒呭揩,鎻愬崌鏁板€?
  3銆佺己鐐?涓€鏃︿竴涓‖鐩樻寕鎺?鍒欐崯鍧忓叏閮ㄦ暟鎹?
raid1:
  1銆佺壒鐐?鏁版嵁鍒嗗埆鍐欏叆涓や釜纾佺洏(鍐欎簡涓や唤)
  2銆佷紭鐐?瀹炵幇浜嗘暟鎹浠?
  3銆佺己鐐?纾佺洏浣跨敤鐜囧彧鑳藉埌50%
raid5:
  1銆佺壒鐐?鎻愪緵鐑鐩樺疄鐜版晠闅滄仮澶?
  2銆佷紭鐐?鍙崯鍧?鍧楃鐩?鏁版嵁涓嶄細鎹熷潖
  3銆佺己鐐?鍚屾椂鍧?鍧楃鐩?鏁版嵁鎹熷潖

鍛ㄦ湡鎬ц鍒掍换鍔?/span>

# 1銆佽繘鍏ュ懆鏈熸€ц鍒掍换鍔?/span>
crontab -e (棣栨杩涘叆鎸? - 鎵緑im)

# 璁剧疆鍛ㄦ湡鎬ц鍒掍换鍔?/span>
* * * * *  : 浜斾釜*鍙蜂唬琛? 鍒?鏃?鏃?鏈?鍛?
鍒?锛?-59
鏃?锛?-23
鏃?锛?/span>1-31
鏈?锛?/span>1-12
鍛?锛?-6

# 寮€濮嬭缃?: 
1銆?span style="color: #800000;">鈥?/span>*鈥?/span> 浠h〃鎵€鏈夊彲鑳藉€?
2銆?span style="color: #800000;">鈥?/span>,鈥?/span> 鎸囧畾澶氫釜鏃堕棿鐐?
3銆?span style="color: #800000;">鈥?/span>/鈥?/span> 鎸囧畾鏃堕棿闂撮殧棰戠巼
4銆?span style="color: #800000;">鈥?/span>-鈥?/span> 鎸囧畾涓€涓椂闂存

# 绀轰緥
1銆佹瘡鏈堢殑1鏃ュ拰5鏃ヤ袱澶? * * 1,5 * * 
2銆佹瘡10鍒嗛挓: */10 * * * * 
3銆?鐐?6鐐规瘡灏忔椂鎵ц: 0 0-6/1 * * *
4銆佹瘡鍒嗛挓鎵ц: * * * * *

# 缁冧範
1銆佹瘡灏忔椂鐨勭3鍒嗛挓鍜岀15鍒嗛挓鎵ц

2銆佹瘡鍛ㄥ叚銆佸懆鏃ョ殑0鐐规墽琛屼竴涓?01.py 鏂囦欢

6銆佹瘡澶?8:00鍒?3:00涔嬮棿姣忓皬鏃舵墽琛?01.py 鏂囦欢 

鏂囨湰澶勭悊宸ュ叿 - awk

璇硶鏍煎紡:awk 閫夐」 鈥?/span>鍔ㄤ綔鈥?/span> 鏂囦欢鍒楄〃

 

甯哥敤鏂瑰紡:Linux鍛戒护  |   awk  閫夐」  鈥樺姩浣溾€?/span>

浣跨敤鏂规硶:

# 绀轰緥
awk 鈥?/span>print "abc"鈥?/span> ip.txt
# 鎬濊€? 杩欎釜浼氳緭鍑轰粈涔堬紵
df -h | awk 鈥?/span>print $1鈥?/span>

# -F锛氭寚瀹氬垎闅旂
awk -F ":" 鈥?/span>print $2鈥?/span>  # 鏄剧ず : 鍒嗛殧鍚庣殑绗?鍒?/span>
# 缁冧範
杈撳嚭鏈満鐨処P鍦板潃

grep鍛戒护涔嬫鍒欒〃杈惧紡

# 鍏冨瓧绗?- grep鍛戒护
^xxx : 浠?xxx 寮€澶?
xxx$ : 浠?xxx 缁撳熬
.    : 浠绘剰1涓瓧绗?涓嶅寘鍚玕n)
*    : 0鍒皀涓瓧绗?
# 鎵╁睍鍏冨瓧绗?- egrep 鎴栬€?grep -E 
+    : 1娆℃垨n娆?
n  : n娆?
()   : 鍒嗙粍

# 鍏朵粬
[0-9]    : 鏁板瓧
[a-zA-Z] : 澶у皬鍐欏瓧姣?  鎴栬€匸a-Z]

缁冧範: 浣跨敤Linux姝e垯鍖归厤Mac鍦板潃
     00:0c:29:70:e1:5f
([0-9a-fA-F]2:)5[0-9a-fA-F]2
# 鎻愬彇鏈満mac鍦板潃
ifconfig | egrep 鈥?/span>([0-9a-fA-F]2:)5[0-9a-fA-F]2鈥?/span> | awk 鈥?/span>print $2鈥?/span>

 

以上是关于shell鍛戒护2的主要内容,如果未能解决你的问题,请参考以下文章

docker瀹瑰櫒涓殑EntryPoint鍜孋MD鍛戒护鍖哄埆

Bash 涓娇鐢ㄦ帶鍒惰繍绠楃杩炴帴鍛戒护 | Linux 涓浗

涓€瀛﹀氨浼氱殑git鍛戒护

SSH鎿嶄綔linux鍛戒护

Windows鍛戒护

Linux绯荤粺-鍛戒护琛屽揩鎹烽敭