little tips and tricks, which i stumbled upon randomly

Showing posts with label unix. Show all posts
Showing posts with label unix. Show all posts

Friday, August 7, 2015

How to find which process is holding file cache (disk space) in aix

fuser -dV <path>

Thursday, July 4, 2013

Find string in file Unix

find . -exec grep -l "search string" {} \;

Wednesday, May 15, 2013

unix while loop in bash

Simple as is :)

i=0;while [ $i -le 1 ]; do clear;ps -ef | grep java;sleep 3;done

Tuesday, November 13, 2012

Readable folder size command in IBM AIX

to get folder size in readable format use
du -gs *| sort -n

click for SUN Solaris command

Wednesday, August 15, 2012

HTML mail from SybaseIQ- Sendmail linelength problem (weird ! character)

One of the best ways to send HTML mail from SybaseIQ on IBM AIX is to use sendmail.
Unfortunately sendmail has linelength limit (2040 characters default). After 2040th character sendmail is adding ! and new line characters to text which is ruining HTML.

To fix this problem:
  1. Change Linelimit info in Sendmail.cf file. Add L=4096 (or any other suitable value) to corresponding mailer.
  2. To identify correct mailer check mail log at /var/log/maillog file. Mailer name is mostly Mrelay
  3. After these steps ! character shall be removed from your mail.
  4. You may add ||  CHAR(13) || CHAR(10) after each </tr> statement to add new line in SQL as well.
Sample script which sends HTML mail from Sybase IQ is below
execute immediate 'exec xp_cmdshell ''(echo "From: myadreess@mail.com."; echo "To: dest1@mail.com,dest2@mail.com"; echo "MIME-Version: 1.0";echo "Content-Type: text/html"; echo "<html><body bgcolor=black><blockquote><font color=green>GREEN</font> <font color=white>WHITE</font> <font color=red>RED</font><font color=blue>Powered by Sybase IQ</font></blockquote></body></html>") | sendmail -t''';

Thursday, June 7, 2012

How to get folder and subfolder size in readable format unix

AIX code is below, for orther unix systems use lower h
du -gH /* | sort -n