Linux shell 剪藏

2017-06-01

  • 查看linux下python的最高版本

python_ver=$(ls /usr/bin|grep -e "^python[23]\.[1-9]\+$"|tail -1)

  • 删除server.py进程
eval $(ps -ef | grep "[0-9] ${python_ver} server\\.py m" | awk '{print "kill "$2 }')                                                                                        

或者使用

ps -ef | grep "[0-9] ${python_ver} server\\.py m" | awk '{print $2 }' | xargs kill -9                                                                                    
  • 返回当前脚本所在目录

cd $(dirname $0)==在命令行下无效,因为返回的是“.“即为当前路径==

  • 安装依赖项

CENTOS:

yum install -y unzip openssl-devel gcc swig python python-devel python-setuptools autoconf libtool libevent automake make curl curl-devel zlib-devel perl perl-devel cpio expat-devel gettext-devel

Ubuntu

apt-get -y install python python-dev python-pip python-m2crypto curl wget unzip gcc swig automake make perl cpio build-essential
  • 查看设备公网IP
ip addr show eth0 | grep inet | awk '{ print $2; }' | sed 's/\/.*$//g'(也可不加g)
  • 自动生成UUID
cat /proc/sys/kernel/random/uuid
  • Nginx无法转发流量到内网
setsebool -P httpd_can_network_connect 1

  • 由于SElinux限制引起的Nginx无法正向代理网站
chcon -Rt httpd_sys_content_t /path/to/www
  • 通过 crt 和 key 文件生成 pem 证书
cat /etc/ssl/xip.io/xip.io.crt /etc/ssl/xip.io/xip.io.key \
    | sudo tee /etc/ssl/xip.io/xip.io.pem
linux

How to compile BBR on CentOS7

“在Telegram上实现微信收发”——EHForwarderBot搭建指南

comments powered by Disqus