surface pro 3 禁用触屏功能
2017-05-31 software windows microsoft 1 mins 2 图 161 字
我的 surface pro 3 屏幕摔坏了。左下角直接破了。惨绝人寰:
触摸屏以后反正是不用想着再用了。可能是碎屏导致,鼠标指针老是飘到右下角的位置,非常影响使用。
禁用的方法也简单,右键点击我的电脑,在 管理 -> 设备管理器 -> 人体学输入设备 -> 符合 HID 标准的触摸屏 上,右键点击禁用即可
一个简单的监控 CPU 的脚本
2017-05-25 tech linux shell 1 mins 1 图 411 字
最近服务器经常出现 CPU 100%,然后超负荷运行的情况。
按照朋友的经验,可能是数据库的问题。查了一下,果然是,虽然目前还不知道是什么原因。
目前就做了一个临时处理,查看 CPU 是否异常,异常的话就重启 postgresql。并生成标记文件 tmp,停止监控。每隔半小时会删除标记文件 tmp,继续监控。
#!/bin/bash
cpu=`vmstat| sed -n '3p' | awk '{print $13}'`;
if [ $cpu -gt 95 ]; then
if [ ! -e /tmp/restart_postgres.tmp ]; then
touch /tmp/restart_postgres.tmp
service postgresql restart;
echo "cpu: $cpu . service postgresql restart";
fi
fi
升级到 php7
2017-05-22 tech php 4 mins 1431 字
嗯,昨晚在浏览一个github项目:微信小程序开发资源汇总,不知道怎么抽筋了然后跑去升级php7了。(●ˇ∀ˇ●)。嘛,记录一下升级过程。
虽说是升级,但是我并没有破坏原来的php5.6的环境,如果需要切换环境的话,只要做少量修改就可以恢复为原来的环境了。
下载
cd /tmp
wget http://am1.php.net/distributions/php-7.1.5.tar.gz
安装
tar -xzvf php-7.1.5.tar.gz
cd php-7.1.5
./configure --prefix /usr/share/php7 --enable-fpm --with-fpm-user=www-data --with-fpm-group=www-data --with-pcre-regex --with-openssl=shared --with-kerberos --with-zlib=shared --enable-bcmath=shared --with-bz2=shared --enable-calendar=shared --with-curl=shared --enable-exif=shared --with-gd=shared --with-jpeg-dir=/usr/include/jpeg8 --with-png-dir=/usr/include/libpng12 --with-gettext=shared --with-gmp=shared --with-mhash=shared --enable-intl=shared --enable-mbstring=shared --with-mcrypt=shared --enable-opcache --with-pdo-pgsql=shared --with-pgsql=shared --enable-shmop=shared --enable-soap=shared --enable-sockets=shared --with-xsl=shared --enable-zip=shared
make clean && make && make install
make test
配置
保留以前链接
cd /usr/local/bin
ln -s /usr/share/php5.6/bin/php php5.6
ln -s /usr/share/php5.6/sbin/php-fpm php-fpm5.6
cp /usr/share/php5.6/lib/php.ini /usr/share/php7/lib/php.ini
cp /usr/share/php5.6/etc/php-fpm.conf /usr/share/php7/etc/php-fpm.conf
cp /tmp/php-7.1.5/sapi/fpm/php-fpm /usr/share/php7/sbin/php-fpm
cp -R /usr/share/php5.6/etc/pool /usr/share/php7/etc/pool
重建链接
rm php php-fpm
ln -s /usr/share/php7/bin/php php
ln -s /usr/share/php7/sbin/php-fpm php-fpm
完成后重启一下机器,重新启动php-fpm即可。