分类目录归档:Linux

Linux双网卡 双线 双网关 配置

2.增加2个路由表分别是电信:a0 联通:b1
# vi /etc/iproute2/rt_tables
252 a0
251 b1
ip route flush table a0
ip route add default via 172.31.16.1 dev eth0 src 172.31.17.107 table a0
ip rule add from 172.31.17.107 table a0

ip route flush table b1
ip route add default via 172.31.32.1 dev eth1 src 172.31.43.225 table b1
ip rule add from 172.31.43.225 table b1

统计php-fpm内存占用总量

ps auxf|grep www_sockets | grep -v grep | awk ‘{print $6}’ | awk ‘{sum+=$1} END {print “Memory =”, sum/1024/1024, “GB”}’

根据需求定制 红色部分是你要修改的部分

Linux 系统级别PATH添加目录

修改此文件 /etc/profile.d/sh.local ,添加如下内容

pathmunge /usr/local/bin after
# pathmunge 是个shell函数 after 表示在路径后面添加,不加after 表示在路径签名加
# /usr/local/bin 是我们要添加到PATH的路径

docker初探小记


# 启动个nginx
docker run --detach --publish 80:80 --name webserver nginx
# 停止nginx
docker container stop webserver
# 删除容器
docker container rm webserver

–detach等于-d 后后台运行的意思

可参考链接:
http://www.runoob.com/docker/docker-command-manual.html

CentOS 7安装docker:

yum-config-manager \
    --add-repo \
    https://download.docker.com/linux/centos/docker-ce.repo
yum install docker-ce docker-ce-cli containerd.io

高效的简洁的inotify+rsync同步代码

#!/bin/bash
inotifywait -mrq /mnt/www/xxx --format "%w%f %e" -e modify,attrib,close_write,moved_to,moved_from,move,create,delete,delete_self,unmount | while read line
do
  # echo $line
  e=`echo ${line##* }`
  f=`echo ${line% *}`
  if [[ "$f" =~ "/mnt/www/xxx/patchs/" ]] || [[ "$f" =~ "/mnt/www/xxx/release/releases/" ]]; then
    # 排除两个不需要同步的目录
    continue
  fi
  if [[ ! -e "$f" ]]; then
    continue
  fi
  if [[ "$e" =~ "MOVED_TO" ]] || [[ "$e" =~ "CLOSE_WRITE" ]] || [[ "$e" =~ "ATTRIB" ]] || [[ "$e" =~ "CREATE,ISDIR" ]]; then
    rsync -a --delete-after $f f22@host1:$f
    rsync -a --delete-after $f f22@host2:$f
  elif [[ "$e" =~ "DELETE" ]] || [[ "$e" =~ "MOVED_FROM" ]]; then
    rsync --delete -a $f f22@host1:$f
    rsync --delete -a $f f22@host2:$f
  fi
done

LVM ext4缩容

缩减逻辑卷,xfs不支持,缩减前先unmount

e2fsck -f /dev/vg1/lv1 #检查磁盘错误 (针对ext4执行)
resize2fs /dev/vg1/lv1 100M #更新逻辑卷信息(针对ext4执行)
lvresize -L 100M /dev/vg1/lv1 #重新设定大小

作者:pcct
来源:CSDN
原文:https://blog.csdn.net/lovektm/article/details/78461453
版权声明:本文为博主原创文章,转载请附上博文链接!