CA BD NY
  • Categories

  • Recent Posts

  • RSS MySQL Hacker

  • RSS Apache Hacker

  • RSS MiniCTO

  • Meta

  • Archive for the shell Category


    Quick and Dirty Monitoring Tool

    Published February 23rd, 2010

    Recently, we needed a simple cron script to record load average, apache server count, existence of lighthttpd and mysql status in a log file every 10 minutes. So following shell script was born:
    #!/bin/sh

    httpd_cnt=`ps auxww | grep ‘/home/apache/bin/httpd’ | wc -l`
    lighthttpd_cnt=`ps auxww | grep ‘lighthttpd’ | wc -l`
    mysql_status=`/usr/bin/mysqladmin -u root -pYOUR_DB_PWD status`
    load=`/bin/cat /proc/loadavg`
    now=`date “+%m-%d-%Y %H:%M:%S”`
    today=`date [...]

    Stopping colored listings for ls

    Published April 3rd, 2009

    How to stop ls from using colors!

    Working around shell command-line wildcard limitations

    Published January 5th, 2009

    How to avoid shell wildcard limitations for commands like rm -f *