#!/bin/bash
if ! [[ "${variable}" =~ ^[0-9]+$ ]]
then
echo "This variable is not a integer"
else
echo "This variable is a integer"
fi
Reference: http://stackoverflow.com/questions/806906/how-do-i-test-if-a-variable-is-a-number-in-bash
2012年3月19日 星期一
Shell check if a variable is a number (Integer)
Get installed rpm and format output
rpm -qa | uniq | sort | xargs rpm -q --qf "%{NAME},%{VERSION},%{RELEASE}\n" | uniq
2012年3月6日 星期二
Dnsmasq settings
domain=wiwynn.com ##Random IP #dhcp-range=172.16.0.201,172.16.0.300 ##Only static IP dhcp-range=172.16.0.0,static ##Router #dhcp-option=3,172.16.0.1 dhcp-option=option:router,172.16.0.1 ##Name server #dhcp-option=6,172.16.0.1 dhcp-option=option:dns-server,172.16.0.1 ##NTP server #dhcp-option=42,172.16.0.1 dhcp-option=option:ntp-server,172.16.0.1 dhcp-lease-max=1000 dhcp-authoritative ##Bootp dhcp-boot=pxelinux.0,172.16.0.1 ##Static IP and hostname to MAC address dhcp-host=00:26:2d:09:5e:c6,172.16.0.101,juju1 ##Forward domain archive.ubuntu.com query to 8.8.8.8 server=/archive.ubuntu.com/8.8.8.8 ##Bind all host in main.wiwynn.com to 172.16.0.1 address=/main.wiwynn.com/172.16.0.1
Check option parameter:
sudo dnsmasq --help dhcp
2012年3月1日 星期四
PXEBoot config
Content of pxe config ( /var/lib/tftpboot/pxelinux.cfg/default )
Content of nfs config( /etc/exports )
Content of pxe config ( /var/lib/tftpboot/pxelinux.cfg/default )
DEFAULT menu
PROMPT 0
MENU TITLE Cobbler | http://fedorahosted.org/cobbler
TIMEOUT 50
TOTALTIMEOUT 6000
ONTIMEOUT local
##Boot into local hard disk
LABEL local
MENU LABEL (local)
MENU DEFAULT
LOCALBOOT -1
##Boot into busybox, the busybox is copied from ubuntu install iso.
LABEL busybox
MENU LABEL busybox
kernel /sources/busybox/linux
append initrd=/sources/busybox/initrd.gz
##Boot into ubuntu desktop amd64 live environment.
##Can't install ubuntu from this mode.
LABEL ubuntu-1110-desktop-amd64
MENU LABEL Ubuntu 11.10 desktop amd64
kernel /sources/ubuntu/1110/desktop/amd64/vmlinuz
append initrd=/sources/ubuntu/1110/desktop/amd64/initrd.lz boot=casper root=/dev/nfs netboot=nfs nfsroot=192.168.116.1:/var/lib/tftpboot/sources/ubuntu/1110/desktop/amd64/nfs
##Boot into ubuntu desktop i386 live environment.
##Can't install ubuntu from this mode.
LABEL ubuntu-1110-desktop-i386
MENU LABEL Ubuntu 11.10 desktop i386
kernel /sources/ubuntu/1110/desktop/i386/vmlinuz
append initrd=/sources/ubuntu/1110/desktop/i386/initrd.lz boot=casper root=/dev/nfs netboot=nfs nfsroot=192.168.116.1:/var/lib/tftpboot/sources/ubuntu/1110/desktop/i386/nfs
Mount ISO for provide NFS datasudo mount -t auto -o loop ubuntu-1110-desktop-amd64.iso /var/lib/tftpboot/sources/ubuntu/1110/desktop/amd64/nfs sudo mount -t auto -o loop ubuntu-1110-desktop-i386.iso /var/lib/tftpboot/sources/ubuntu/1110/desktop/i386/nfs
Content of nfs config( /etc/exports )
/var/lib/tftpboot/sources/ubuntu/1110/desktop/amd64/nfs 192.168.116.0/24(async,no_root_squash,no_subtree_check,ro) /var/lib/tftpboot/sources/ubuntu/1110/desktop/i386/nfs 192.168.116.0/24(async,no_root_squash,no_subtree_check,ro)
訂閱:
文章 (Atom)