28.12.2011

routing table flags

U (route is up)
H (target is a host)
G (use gateway)
R (reinstate route for dynamic routing)
D (dynamically installed by daemon or redirect)
M (modified from routing daemon or redirect)
A (installed by addrconf)
C (cache entry)
! (reject route)

01.12.2011

FreeBSD 8.2 install

portsnap fetch extract
cd /usr/ports/ports-mgmt/portupgrade
make && make install
ee /etc/make.conf
############################

WITHOUT_LINUXTHREADS=yes
NO_INET6=true
WITHOUT_X11=YES

#kernel
KERNCONF=MYCONF
#update
SUP_UPDATE=
SUP= /usr/bin/csup
SUPFLAGS= -g -L 2 -z
SUPHOST= cvsup4.ru.FreeBSD.org
SUPFILE= /usr/share/examples/cvsup/standard-supfile
PORTSSUPFILE= /usr/share/examples/cvsup/ports-supfile
DOCSUPFILE= /usr/share/examples/cvsup/doc-supfile

WITHOUT_DICT="yes"
WITHOUT_GAMES="yes"
WITHOUT_HTML="yes"
WITHOUT_INET6="yes"
WITHOUT_INET6_SUPPORT="yes"
WITHOUT_USB="yes"
WITHOUT_X11="yes"
WITHOUT_BLUETOOTH="yes"
NO_BLUETOOTH="yes"
WITHOUT_ATM="yes"
WITHOUT_IPX="yes"
WITHOUT_CDDL="yes"
WITHOUT_FLOPPY="yes"
WITHOUT_INET6="yes"
WITHOUT_NCP="yes"
WITHOUT_NDIS="yes"

############################
#pkg_add cvsup-without-gui
#cd /usr/src && make update

#mkdir /root/kernels && ee /root/kernels/BSDRASsrv
#ln -s /root/kernels/BSDRASsrv

#make -j4 buildworld

#make buildkernel
#make installkernel
#reboot
(booting in single mode 4)
#mount -u /
#mount -a
#cd /usr/src && make installworld
#reboot

#/usr/local/sbin/portinstall -cCrR subversion
#/usr/local/sbin/portinstall -cCrR bash screen
#ee .bashrc
export PS1='\[\e[1;31m\][\u@\h \W]\$\[\e[0m\] '
export TERM=linux
alias ls='ls -GAh'
alias ll='ls -l'
alias grep='grep --color'
alias fgrep='fgrep --color'
#ee .screenrc
vbell off
defscrollback 5000
hardstatus alwayslastline
hardstatus string '%{= kG}%-Lw%{= kW}%50> %n*%f %t%{= kG}%+Lw%< %{= kG}%-=%D %m/%d/%y | %C:%s %A | %1`%{-}'
screen -t main
scselect 0
#pw usermod root -s /usr/local/bin/bash



23.11.2011

graphic without perl


# for i in 2 12 56 2 4; do x=1; while [ $x -le $i ];do echo -n .;x=$(( $x + 1 )) ;done; echo ; done  
..
............
........................................................
..
....

simple graphic

for i in 2 12 56 2 4; do echo $i|perl -e 'while (<>) { print "."x $_ . "\n"; }'; done

..
............
........................................................
..
....

Sort on multiple fields


$ cat quota
 bob 1000
 an 1000
 chad 1000
 don 1500
 eric 5000
 fred 2000

 $ sort -k2n,2 -k1,1 quota
 an 1000
 bob 1000
 chad 1000
 don 1500
 fred 2000
 eric 5000

cisco acces-list filter

grep denied cisco_security.log |grep 2082|grep 192.168.192.11 |awk '{print $18}'|sed 's/(.*//g'|sort|uniq -c|sort -g   

one linersync a slave that is facing duplicate entry errors.

while [ 1 ]; do if [ `mysql -u root -e "show slave status \G;" | grep "Duplicate entry" | wc -l` -eq 1 ] ; then mysql -u root -e “stop slave; set global sql_slave_skip_counter=1; start slave;”; fi; sleep 1; mysql -u root -e “show slave status\G”; done

22.11.2011

сложение HEX в BASH

echo $((0x8B4513 + 0x1))|xargs printf "%X\n"