2015年3月17日 星期二

dnsmasq 設定範例

domain=private.network
dhcp-range=tag:g1,192.168.0.1,192.168.0.100
dhcp-option=tag:gluster,1,255.255.0.0
dhcp-option=tag:gluster,28,192.168.255.255
dhcp-option=tag:gluster,3,192.168.0.1
dhcp-option=tag:gluster,6,192.168.0.1
dhcp-option=tag:gluster,12,test2
dhcp-option=tag:gluster,15,abc.aas
dhcp-boot=tag:gluster,pxelinux.0,abc.ccc,192.168.10.211

dhcp-host=32:64:33:64:39:39,set:gluster,192.168.10.100,g4,infinite

常用 DHCP Option Code

1:Subnet Mask
3:Router Option
6:Domain Name Server Option
12:Host Name Option
15:Domain Name
28:Broadcast Address Option


參考
DHCP Options and BOOTP Vendor Extensions
https://tools.ietf.org/html/rfc2132

PowerShell 取得目前系統其他 Powershell script 資訊

get-process -id $pid
write $pid == $args[0]
Start-Sleep 30

Get-WmiObject Win32_Process -Filter "name = 'PowerShell.exe'" | select CommandLine,Handle

Powershell lock file

try {

$LockFile = [System.io.File]::Open("e:\ps1\1.txt", 'Open', 'Read','None')

sleep 100

$LockFile.Close()

}

Catch
{
    Break
}

bash shell lock file

#!/bin/bash

exec 100>x
flock -n 100 || exit 1
sleep 1000