摘要: varnish 代理软件 反向代理 【web加速服务器】,缓存在内存varnish 【web加速服务器】,缓存在内存varnish可以用内存或者硬盘来做缓存安装Varnish[root@stu ~]# tar -xf varnish-3.0.6.tar.gz[root@stu varnish-3.0 阅读全文
posted @ 2021-08-08 15:51 Linux刀客 阅读(138) 评论(0) 推荐(0)
摘要: 中断及退出break,continue,exitcontinue: 跳转至下一次循环break:结束循环exit:退出脚本for i in {1..254}do [ $i -eq 10 ];continue ssh 192.168.4.$i shutdown -h nowdone[root@vh01 阅读全文
posted @ 2021-08-08 11:50 Linux刀客 阅读(86) 评论(0) 推荐(0)
摘要: shell中的函数函数 [避免重复的代码]定义函数函数名 () { 命令 命令}调用函数mymkdir(){mkdir /testcd /testlsecho "ok"}[root@vh01 init.d]# vim myhttpd#!/bin/bash#chkconfig: - 80 90star 阅读全文
posted @ 2021-08-08 11:47 Linux刀客 阅读(60) 评论(0) 推荐(0)
摘要: case语句(简单) if语句case 变量 in值1) 命令;;值2) 命令;;值3) 命令;;*) 命令;;esac[root@vh01 script]# vim i.sh#!/bin/bashcase $1 in-c) cat $2;;-v) vim $2;;-d) rm -rf $2;;-t 阅读全文
posted @ 2021-08-08 11:46 Linux刀客 阅读(375) 评论(0) 推荐(0)
摘要: shell中的循环语句for循环for语法格式1:for 变量 in 值1 值2 值3 值4 值5 值6 ... ...do 命令donefor i in 1 88 3 90do echo $1done[root@vh01 script]# vim f.sh#!/bin/bashfor i in 1 阅读全文
posted @ 2021-08-08 11:45 Linux刀客 阅读(559) 评论(0) 推荐(0)
摘要: shell中的if语句格式1:单分支if [ 判断 ];then 命令fi 格式2:双分支if [ 判断 ];then 命令else 命令fi格式3:多分支if [ 判断 ];then 命令elif 命令elif 命令else 命令... ...fi#!/bin/bashnum=$[RANDOM%1 阅读全文
posted @ 2021-08-08 11:42 Linux刀客 阅读(1046) 评论(0) 推荐(0)
摘要: shell的测试表达式[ 表达式 ][空格 数字 空格 数字 空格]test 表达式1、字符串测试-z 字串为空 [ -z 字符串 ]!-z字串为非空 [ !-z 字符串 ][root@vh01 ~]# a=12[root@vh01 ~]# [ -z $a ][root@vh01 ~]# echo 阅读全文
posted @ 2021-08-08 11:41 Linux刀客 阅读(159) 评论(0) 推荐(0)
摘要: shell的数值运算整数【3种】1、expr 数字 运算符 数字+ - /* / %取余[root@vh01 script]# expr 2+ 5expr: 语法错误[root@vh01 script]# expr 2 + 57[root@vh01 script]# expr 2 - 5-3[roo 阅读全文
posted @ 2021-08-08 11:40 Linux刀客 阅读(316) 评论(0) 推荐(0)
摘要: Shell 变量ip=192.168.4.254soft=ftpbaseurl=ftp://$ip/rhel6/Serveryum-y install $softservice $soft startchkconfig $soft on变量名称=变量值变量名称:字母,数字,_,但是不能以数字开始相关 阅读全文
posted @ 2021-08-08 11:39 Linux刀客 阅读(82) 评论(0) 推荐(0)
摘要: shell1、什么叫shell在linux内核与用户之间的解释器程序通常指/bin/bash负责向内核翻译及传达用户、程序指令相当于操作系统的“外壳”、2、shell的使用方式交互式 命令行非交互式 脚本硬件 系统软件【内核】 应用软件 人shell, bash, sh, kshshell[命令解释 阅读全文
posted @ 2021-08-08 11:38 Linux刀客 阅读(92) 评论(0) 推荐(0)
摘要: squid(代理服务器) client:192.168.4.1 eth0 squid:192.168.4.5 eth0 192.168.2.5 eth1 web:192.168.2.100 eth1环境配置1、真实机(确认:virbr1(192.168.4.1))web网站【加速】代理软件 varn 阅读全文
posted @ 2021-08-08 11:27 Linux刀客 阅读(496) 评论(0) 推荐(0)