Archive for January 20th, 2010

  • Adding route in linux

    Wednesday, January 20th, 2010

    route add -net 172.16.1.0 netmask 255.255.248.0 gw 192.168.1.5 (eth2 IP adress) eth2

  • Apache HTTP server benchmarking tool

    Wednesday, January 20th, 2010

    ab -c 50 -n 2000 ‘http://192.168.1.1/test.php’

  • Check disk use

    Wednesday, January 20th, 2010

    du -h –max-depth=1 Remount root partition ######################### mount -o remount,rw /

  • Swap

    Wednesday, January 20th, 2010

    ‘swapoff -a && swapon -a’

  • Apache Log Rotation

    Wednesday, January 20th, 2010

    CustomLog “|/usr/sbin/rotatelogs /etc/httpd/logs/access_log 2048M” combined CustomLog “|/usr/sbin/rotatelogs /home/prod/gWire/php.log 2048M” combined Apache Log with own separator, which will help to filter the logs for further processing ########################################## LogFormat “%{X-Forwarded-For}i#%v#%l#%a#%U#%b#%t \”%r\” %>s \”%{User-Agent}i\”” common

  • Processes memory which is in RAM

    Wednesday, January 20th, 2010

    Running the follwing on Debian Etch will show you the Resident Set Size (RSS – which is the portion of a processes memory which is in RAM) of your Apache processes. ps -ylC httpd –sort:rss

  • Kill all process “/home/user/dev/apache/bin/httpd”

    Wednesday, January 20th, 2010

    ps aux | grep -i /home/user/dev/apache/bin/httpd | grep -v grep | awk ‘{print $2}’ | xargs kill -9

  • To delete a string (192.168.1.1) from the file

    Wednesday, January 20th, 2010

    sed -i “/string/d” Filename /bin/sed -i “/192.168.1.1/d” /var/log/messages %s/,mianl//g Trim Space at the end ######################################## sed ‘s/ *$//g’ ${LOGFILE} > ${LOGFILE}.1 mv ${LOGFILE}.1 ${LOGFILE}

  • To check the Active http port

    Wednesday, January 20th, 2010

    /bin/netstat -tulpn | grep -vE ‘^Active|Proto’ |grep ‘http’

  • BASH Scripting ~ learning by examples

    Wednesday, January 20th, 2010

    —————————————– Program (1) ~ array.sh —————————————– #!/bin/bash echo “==============” declare -a myarr[0]=”Manoj” declare -a myarr1 myarr1=(Manoj Chauhan bangalore mumbai pune delhi) myarr[1]=”Chauhan” echo “my name is ${myarr[0]} ${myarr[1]}” echo “————————–” echo “${myarr1[*]}” echo ${myarr1[2]} echo ${myarr1[@]} echo “————————–” echo “Total no of elements in array – ${#myarr1[*]}” echo “Total no of elements in array – [...]

  • Installing PDO_OCI extension for php5

    Wednesday, January 20th, 2010

    To enable pdo_oci module you may need to install oracle client and oci8 module is require. I have installed oracle 10g client here. [root@server ~]# export ORACLE_HOME=/usr/lib/oracle/10.2.0.3/client64/ ; export LD_LIBRARY_PATH=/usr/lib/oracle/10.2.0.3/client64/ [root@server ~]# cd /tmp [root@server tmp]# pecl download pdo_oci [root@server tmp]# tar xvzf PDO_OCI-1.0.tar.gz [root@server tmp]# cd PDO_OCI-1.0 && phpize [root@server tmp]# ./configure [root@server PDO_OCI-1.0]# [...]