Monthly Archives: February 2016

df shows wrong tmp size


du -sh /tmp/
976K /tmp/

but: df -h /tmp
tmpfs 4.0G 2.9G 1.2G 71% /tmp

lsof -a +L1 /tmp
mysqld 814658 mysql 5u REG 0,18 6909 0 129877498 (deleted)/tmp/ibDs7ppL
mysqld 814658 mysql 6u REG 0,18 550 0 129877499 (deleted)/tmp/ibdkEKwG
mysqld 814658 mysql 7u REG 0,18 0 0 129877500 (deleted)/tmp/ibJv84DB
mysqld 814658 mysql 8u REG 0,18 0 0 129877581 (deleted)/tmp/ibVsY6gs
mysqld 814658 mysql 22u REG 0,18 0 0 129953780 (deleted)/tmp/ibFXQ0vR
mysqld 814658 mysql 7109u REG 0,18 1511325696 0 130050097 (deleted)/tmp/MYVbKwmg
mysqld 814658 mysql 7138u REG 0,18 1511325696 0 130043510 (deleted)/tmp/MYdDNZUq

mysqladmin processlist

| 13962 | cphulkd | localhost | cphulkd | Query | 27931 | Sorting result | SELECT USER,SERVICE,TYPE,TIMESTAMPDIFF(SECOND, '1970-01-01', LOGINTIME) as LOGINTIME,TIMESTAMPDIFF(S |
| 24119 | cphulkd | localhost | cphulkd | Query | 25842 | Sorting result | SELECT USER,SERVICE,TYPE,TIMESTAMPDIFF(SECOND, '1970-01-01', LOGINTIME) as LOGINTIME,TIMESTAMPDIFF(S |
| 31029 | cphulkd | localhost | cphulkd | Query | 24435 | Sorting result | SELECT USER,SERVICE,TYPE,TIMESTAMPDIFF(SECOND, '1970-01-01', LOGINTIME) as LOGINTIME,TIMESTAMPDIFF(S |
| 120593 | root | localhost | cphulkd | Query | 8229 | Waiting for table flush | LOCK TABLES `auths` READ /*!32311 LOCAL */,`ip_lists` READ /*!32311 LOCAL */,`known_netblocks` READ |
| 152512 | cphulkd | localhost | cphulkd | Query | 2154 | Waiting for table flush | SELECT USER,SERVICE,TYPE,TIMESTAMPDIFF(SECOND, '1970-01-01', LOGINTIME) as LOGINTIME,TIMESTAMPDIFF(S |

mysql -e "SELECT CONCAT('KILL ',ID,';') FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'cphulkd' AND COMMAND = 'Query' AND TIME > 100 INTO OUTFILE '/tmp/kill_list.txt';" && mysql -e "source /tmp/kill_list.txt" && rm -rf /tmp/kill_list.txt

cut magic

cut and print 2 to rest of all columns.
# echo www.domain.com | cut -d"." -f2-
domain.com

cut and print 2nd column.
# echo www.domain.com | cut -d"." -f2
domain

cut and print first to 2nd column.
# echo www.domain.com | cut -d"." -f-2
www.domain

cut and print 1st,3rd columns.
# echo www.domain.com | cut -d"." -f1,3
www.com

cut and print 1st and 4 to rest of all columns.
# echo a.b.c.d.e | cut -d"." -f4-,1
a.d.e

cut and print 1 to 3 and 5th columns.
# echo a.b.c.d.e | cut -d"." -f1-3,5
a.b.c.e

cut and print 3rd character.
# echo abcde | cut -c3
c

cut and print 3-rest of characters.
# echo abcde | cut -c3-
cde

cut and print first-3 of all characters.
# echo abcde | cut -c-3
abc

pppd[]: Sorry – this system lacks PPP kernel support

pptpd[]: GRE: read(fd=6,buffer=611860,len=8196) from PTY failed: status = -1 error = Input/output error, usually caused by unexpected termination of pppd, check option syntax and pppd logs

vzctl stop 101
vzctl set 101 --features ppp:on --save
vzctl start 101
vzctl set 101 --devices c:108:0:rw --save
vzctl exec 101 mknod /dev/ppp c 108 0
vzctl exec 101 chmod 600 /dev/ppp

modprobe tun
modprobe ppp-compress-18
modprobe ppp_mppe
modprobe ppp_deflate
modprobe ppp_async
modprobe pppoatm
modprobe ppp_generic

ubuntu install laravel nginx

apt-get update
apt-get install nginx php5-fpm php5-cli php5-mcrypt git

vim /etc/php5/fpm/php.ini
cgi.fix_pathinfo=0

mkdir -p /var/www/laravel
vi /etc/nginx/sites-available/default

server {
listen 80 default_server;
listen [::]:80 default_server ipv6only=on;

root /var/www/laravel/public;
index index.php index.html index.htm;

server_name server_domain_or_IP;

location / {
try_files $uri $uri/ /index.php?$query_string;
}

location ~ \.php$ {
try_files $uri /index.php =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}

cd ~
curl -sS https://getcomposer.org/installer | php
mv composer.phar /usr/local/bin/composer
composer create-project laravel/laravel /var/www/laravel