# 检测网站 ```bash #!/bin/bash WEBSITE=(baidu.com www.qq.com www.163.com https://www.google.com.hk) export http_proxy=http://127.0.0.1:8118 export https_proxy=http://127.0.0.1:8118 DATE=`date '+%Y-%m-%d %H:%M:%S'` #echo $DATE for ((i=0;i<"${#WEBSITE[*]}";i++)) do CODE=`curl -A "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:64.0) Gecko/20100101 Firefox/64.0" -o /dev/null -s --connect-timeout 5 --max-time 5 --referer "www.baidu.com" -w %{http_code} ${WEBSITE[$i]}` if [ $CODE -ne "200" ];then echo "TIME: $DATE \nISSUE: ${WEBSITE[$i]} is down \n"CODE: " $CODE" fi done ``` ```bash #!/bin/bash for i in {1..255} do CODE=`curl -o /dev/null -s --connect-timeout 1 --max-time 1 -w %{http_code} http://192.168.9.$i`; if [ $CODE -ne "000" ];then echo $CODE+"//"+$i fi done ``` ```bash #!/bin/bash export http_proxy=http://127.0.0.1:8118 export https_proxy=http://127.0.0.1:8118 wget -t 2 -T 5 --spider http://google.com &> /dev/null if [ $? -eq 0 ];then echo "check is OK" else echo "check is FAILED" fi ``` # zsh ## 查看 ```bash cat /etc/shells ``` ## 安装 ```bash sudo yum install -y zsh wget https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh -O - | sh ``` ## 配置 ```bash #改为zsh chsh -s /bin/zsh #恢复bash chsh -s /bin/bash root ``` ## 换肤 ```bash vi ~/.zshrc ZSH_THEME="robbyrussell" ``` ## 语法高亮 ```bash cd ~/.oh-my-zsh/custom/plugins git clone git://github.com/zsh-users/zsh-syntax-highlighting.git vi ~/.zshrc plugins=( git zsh-syntax-highlighting ) ``` # vi ```bash vi ~/.vimrc ``` ```toml " 语法高亮 syntax on " 显示行号 set nu " 侦测文件类型 filetype on " 制表符为4 set tabstop=4 " 统一缩进为4 set softtabstop=4 set shiftwidth=4 " 不要用空格代替制表符 set noexpandtab " 不要换行 set nowrap set fileencodings=utf-8,ucs-bom,gb18030,gbk,gb2312,cp936 set termencoding=utf-8 set encoding=utf-8 ``` # systemd设置PATH ```bash # systemd无法获取/etc/profile中设置的PATH变量,使用Environment参数在/lib/systemd/system/nginx.service文件中传入 Environment="PATH=/sbin:/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/opt/cni/bin" ``` ```bash sudo mkdir -p /etc/systemd/system/docker.service.d/ #sudo vi /etc/systemd/system/docker.service.d/docker.conf cat > /etc/systemd/system/docker.service.d/docker.conf < /tmp/hell.sh <