Posts

bash script to check left space on device

This is a very simple bash script intended to be used for checking the space on every partition from your hardisk #!/bin/bash PROG_NAME="space_usage" #Set usage USED_SPACE="95" #log file if you want to use log file LOG_FILE="space.txt" #email address EMAIL="user@localhost" SEND_EMAIL="N" #crontab every night at 12 #0 0 * * * root space.sh function log() { /usr/bin/logger -i -p kern.crit -t ${PROG_NAME} "UPSS: ${i[5]} has used more than $USED_SPACE % space" echo "UPSS: ${i[5]} has used more than $USED_SPACE % space" >> $LOG_FILE #send email if [ $SEND_EMAIL == 'Y' ] then mail -s "no more space on ${i[5]} " $EMAIL fi } #grep mounted partitions df -k -P --sync |grep -v "Mounted" | while read i; do i=( ${i} ) #echo mounted partitions #echo ${i[5]} USED=`df ${i[5]} | awk '{print $5}' |grep -v "Use%" | cut -f1 -d%` #...

BitDefender RescueCD

The BitDefender Unices team is re-mastering a rescue cd based on Knoppix Live CD. The re-mastered CD will be capable of scanning and disinfecting all your existing hard drives (including NTFS partitions) before your OS boots. To use this RescueCD, you need to be familiar with a few basic notions, such as: what is a partition and what type of internet connection you have. Another condition would be that you should not be afraid to use the console to type commands and read the manual. The new CD will provide a few tools for data rescue, partition size changes and basic forensic networking. Its main feature is that after the boot, all detected and mounted partitions on your hard drive will be automatically scanned by our antimalware scanner, bdgui. Bdgui is a frontend for bdscan and it was designed to make the disinfection procedure easier for the common user. Plus it looks cool :-). More info here: http://unices.bitdefender.com/?p=12 If you want to download the iso go here : http://dow...

How to disable Talk in Mediawiki

MediaWiki is a free software wiki package originally written for Wikipedia. I'm using mediawiki to document my projects. Anyway, if you want to disable Talk in media wiki follow the next steps. cd your_mediawiki_dir/include cp SkinTemplate.php SkinTemplate.back (just in case) mcedit/vi SkinTemplate.php search for <strong>$content_actions['talk']</strong> uncomment this line /* $content_actions['talk'] = $this->tabAction( $talkpage, 'talk', $this->mTitle->isTalkPage() && !$prevent_active_tabs, '', true); */ The end :)

bad blocks on my hard drive

Not a good day for science. One hard drive from my data server is not working right.Sometimes the system stops responding. Well, to check for badblocks just use smartctl , ofcourse your hdd must know about smartctl.To check use hdparm [...] hdparm -I /dev/hda [...] Commands/features: Enabled Supported: * SMART feature set [...] To see if Checking blocks 0 to 78150744 Checking for bad blocks (read-only test): 23267840/ 78150744 23489984/ 78150744 done Pass completed, 0 bad blocks foundthe hdd is ok run: smartctl -t long /dev/hda In order to check for badblocks run: badblocks -sv /dev/hda If you get something link this: Checking blocks 0 to 78150744 Checking for bad blocks (read-only test): 23267840/ 78150744 23489984/ 78150744 done Pass completed, 0 bad blocks found. ...you are lucky, if not, well...bad day for you :(

When your favorite wireless app is not working

Nowdays, all laptops have wifi cards, and if you have an old laptop you can buy a pcmpcia card,or you can try a USB wifi card ( TL-WN321G ) In linux, you have a lot of wifi manager apps.You can read more about them here But sometimes none of them are working and it's impossible to connect to a free public AP.So, back to the console :) 1- Free AP - to scan for wireless AP in my case, ath0 is the wifi card (i'm using a smc card with atheros chipset, Atheros Communications, Inc. AR5212 802.11abg NIC) iwlist ath0 scanning the result of wifi scanning myust be something like this : ath0 Scan completed : Cell 01 - Address: 00:00:00:00:00:00 ESSID:"free host spot" Mode:Master Frequency:2.437 GHz (Channel 6) Quality=45/70 Signal level=-50 dBm Noise level=-95 dBm to connect to this hot spot type : iwconfig ethX essid "free hot spot" In order to check if you are connected...

How to compile php5 with oracle instant client 11

Well, this is very easy. First you need to download apache web server ,the latest php 5.2.6 from www.php.net and the instantclient11 from oracle download (you need an accont for this one) Unpack your apache archive in your work dir and then type ./configure --enable-so --with-mpm=prefork --enable-ssl=static --with-ssl=/usr/include/openssl/ If all is ok, type make , and after this make install This will install the http server in /usr/local/apache2 dir If you want to have php with oracle instantclient11, unpack the php archive on your disk and type: './configure' '--with-apxs2=/usr/local/apache2/bin/apxs' '--with-pgsql' '--with-gd' '--with-zlib' '--with-oci8=instantclient,/opt/instantclient_11' '--enable-bcmath' '--with-sqlite' '--with-mysql' '--with-mysql-sock=/var/lib/mysql/mysql.sock' '--enable-mbstring' '--with-mcrypt' Offcourse, you must unpack the oracle instantclient11 zip file i...

Why sometimes oracle 10g XE sucks big time

A few days ago, one of my web application that use as backend oracle (i'm running oracle-xe-10.2.0.1-0.1) hangs and refuse to work. I was very surprised of this, because i was more than sure that i did not made any modifications on my web server. First thing i look into it was the apache web server.I try to restart the web server, check the php lib file to see if it is corrupted or missing, check the ORA_HOME enviroment, check it the DMZ server where the oracle 10XE is running respond to my pings and telnets in 1521.Every thing was working as espected, except my web application.I was very frustrated and disappointed. After a while, it hit me, why not check the sqlplus client from ORA_HOME path. Tannnnaaaa...this was the problem.The sqlclient refuse to work or connect to the oracle server. This is the output of the strace that i did on sqlplus \0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 256) = 256 13100 lseek(6, 512, SEEK_SET) = 512 13100 read(6, "\337y \0\0\0\0\0\0\0\0\0\0\...