2013年1月29日 星期二

2013年1月10日 星期四

[Ubuntu][Linux] lftp 多線程下載

當連國外網站,或是下載速度很慢的時候
可使用lftp,用10條thread來下載
$ lftp -e 'pget -n 10 [download_path]'

2013年1月9日 星期三

[git] 取消已經暫存的文件

想要取消已經git add到暫存的文件
$ git reset HEAD [filename]


Extend Reading
想要刪除server的檔案
$ git rm [filename]

2013年1月8日 星期二

[Gerrit] [MySQL] 檢查Gerrit上是否尚有open change

#! /bin/bash

project_name='test'

open_change=$(echo "SELECT change_key FROM changes WHERE (dest_project_name='$project_name') and (open='Y');" | mysql -u[account] -p[password] reviewdb --silent)

if [ ! -n "${open_change}" ]; then
    echo "It dose not exits changes on Gerrit."
    exit 0
else
    echo "It exits changes on Gerrit."
    exit 1
fi

[ShellScript] 判斷變數為空


1. 變量通過" "引號引起來

如下所示:,可以得到結果為 IS NULL.
#!/bin/sh

if [ ! -n "​​$para1" ]; then
  echo "IS NULL"
else
  echo "NOT NULL"
fi



2. 直接通過變量判斷

如下所示:得到的結果為: IS NULL
#!/bin/sh

if [ ! $para1 ]; then
  echo "IS NULL"
else
  echo "NOT NULL"
fi




ref:http://blog.csdn.net/lllxy/article/details/3255554

2013年1月7日 星期一

[Ubuntu] 解決找不到ServerName的問題

解決每次重啟Apache2會有找不到ServerName的問題

apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1 for ServerName

1. 修改httpd.conf這個空文件
$ sudo vi /etc/apache2/httpd.conf

2. 將以下內容複製進去
ServerName localhost