發表文章

目前顯示的是 10月, 2015的文章

lsync - 簡單操作的Linux同步服務

lsync - 簡單操作的Linux同步服務 lsync是一個可以基於rsync傳輸的同步服務,他的好處是可以透過一個簡單的設定檔,即可完成自動化同步作業,讓管理上非常簡單。這邊簡單的以AWS與Google Cloud的兩台雲端主機進行同步作業: Remote: 54.172.25.83 (AWS US-East/N.Virginia) Local: 130.211.248.60 (GCE asia-east1-c) 安裝lsync Debian系列: apt -get update apt -get install git -y apt -get install cmake -y apt -get install build -essential -y apt -get install lua5 .2 apt -get install liblua5 .2 -dev -y git clone https: //github.com/axkibe/lsyncd.git cd lsyncd cmake -DCMAKE_INSTALL_PREFIX = /usr/ local /lsyncd - 2.1 .5 make && make install CentOS系列需要自行下載rpm安裝,可以參考附錄的文件: 執行範例 範例設定檔,在這邊是使用rsync的方式作為傳輸方法~ settings { logfile = "/usr/local/lsyncd-2.1.5/var/lsyncd.log" , statusFile = "/usr/local/lsyncd-2.1.5/var/lsyncd.status" , inotifyMode = "CloseWrite" , maxProcesses = 8 , } sync { default.rsync, source = "/var/www/html" , target = "ec2-user@54.172.25.83:/home/ec2-user/ba...

Test upload常用的兩個方法

常常忘記,還是寫下來好了... Step1: Configure your upload Reference: https://github.com/expressjs/multer Step2: Make a route for receive upload router.post('/uploadtest', function(req, res, next) {   res.end('done...'); }); Step3: Testing Upload using curl: curl -F "image=@/Users/peihsinsu/Pictures/pic2.png" http://localhost:3000/uploadtest -X POST Upload using upload form: <form method="post" action="/uploadtest" name="submit" enctype="multipart/form-data">   <input type="file" name="fileField"><br /><br />   <input type="submit" name="submit" value="Submit"> </form>