2017年3月22日 星期三

X11 over ssh

in Mac to connect to Linux via X11 remote

ssh -X user@host

after password input

gnome-session

the remote display will be ready

Ref:http://forrestbao.blogspot.hk/2008/01/connecting-your-remote-linux-desktop.html

2017年3月2日 星期四

CURL with timeout

Yes. curl has two options: --connect-timeout and --max-time.
Quoting from the manpage:
--connect-timeout <seconds>
    Maximum  time  in  seconds  that you allow the connection to the
    server to take.  This only limits  the  connection  phase,  once
    curl has connected this option is of no more use.  Since 7.32.0,
    this option accepts decimal values, but the actual timeout  will
    decrease in accuracy as the specified timeout increases in deci‐
    mal precision. See also the -m, --max-time option.

    If this option is used several times, the last one will be used.
and:
-m, --max-time <seconds>
    Maximum  time  in  seconds that you allow the whole operation to
    take.  This is useful for preventing your batch jobs from  hang‐
    ing  for  hours due to slow networks or links going down.  Since
    7.32.0, this option accepts decimal values, but the actual time‐
    out will decrease in accuracy as the specified timeout increases
    in decimal precision.  See also the --connect-timeout option.

    If this option is used several times, the last one will be used.
You are probably interested in the latter option, --max-time. For your case set it to 900 (15 minutes).
Specifying option --connect-timeout to something like 60 (one minute) might also be a good idea. Otherwise curl will try to connect again and again, apparently using some backoff algorithm. Here (on Debian) it stops trying to connect after 2 minutes, regardless of the time specified with --connect-timeout and although the default connect timeout value seems to be 5 minutes according to the DEFAULT_CONNECT_TIMEOUT macro in lib/connect.h.
A default value for --max-time doesn't seem to exist, making curl wait forever for a response if the initial connect succeeds.

Ref: http://unix.stackexchange.com/questions/94604/does-curl-have-a-timeout/94612

2017年1月18日 星期三

Docker in mac hostconfig.json

https://www.softwareab.net/wordpress/docker-macosx-modify-hostconfig-existing-container/

screen /Users/#USER/Library/Containers/com.docker.docker/Data/com.docker.driver.amd64-linux/tty

cd /var/lib/docker/containers/${container_hash}/hostconfig.json

to reset docker

http://stackoverflow.com/questions/19335444/how-to-assign-a-port-mapping-to-an-existing-docker-container

1) stop the container 
2) change the file
3) restart your docker engine (to flush/clear config caches)
4) start the container

node.js ruby grunt project

http://gruntjs.com/getting-started


1. npm install
2. npm run build-local

2017年1月6日 星期五

VM centos eth0 not found

Ref:http://www.ntueees.tp.edu.tw/wordpress/?p=454



部署完LINUX OS啟動後會出現下列error:
Bringing up interface eth0: Device eth0 does not seem to be present, delaying initialization [FAILED]
修改設定如下:
1. 將ESXI分配的MAC keyin到ifcfg-eth0
2.刪除/etc/udev/rules.d/70-persistent-net.rules
3.reboot