miércoles, 8 de febrero de 2012

How to send HTML mails from CLI

1. Create the email body.

To: address@example.com

Subject: Subject

Content-Type: text/html; charset="us-ascii"
/* You can of course add more header lines if necessary. */

2. You of course have to replace the To address and the subject line.

3. Save this as mail_html.html.

4. Use sendmail to send this message:

# /usr/sbin/sendmail address@example.com < mail_html.html

Freeze/Unfreeze VCS resources persistently

0. Initial Statements

%GROUP : Is going to be the VCS group needed to be freezed.
%SERVER : Is the Primary Node where the group is online. it can be checked with:

# hagrp -state %GROUP | grep ONLINE


1*** Freeze the cluster resources for this DB group.
a. Login to %SERVER as root.

b. Verify you are in the right host
# [[ "%SERVER" = `uname -n` ]] && echo "Correct Server" || echo "Wrong Server"

c. Check the service group status
# hagrp -state |grep %GROUP
(output should show online on one node, offline on the other)

d. Freeze the servicegroup
# haconf -makerw
# hagrp -freeze %GROUP -persistent
# haconf -dump -makero

e. Verify it is frozen
# hagrp -display %GROUP | grep -i Frozen
(output should show a value of 1)


2*** Unfreeze the cluster resources for this DB group.
a. Login to %SERVER as root

b. Verify you are in the right host
# [[ "%SERVER" = `uname -n` ]] && echo "Correct Server" || echo "Wrong Server"
(output should be the %SERVER)

b. Unfreeze the service group
# haconf -makerw
# hagrp -unfreeze %GROUP -persistent
# haconf -dump -makero

c. Verify it is unfrozen
# hagrp -display %GROUP |grep Frozen
(output should show a value of 0)

d. Verify that the group is ONLINE
# hagrp -state |grep %GROUP
(output should show ONLINE on one node)

Detect LUNs on Hewlett Packard Blades

1. HP tools for Blade Systems

# hp_rescan -a;

2. Using PowerPath driver

# powermt config;
# powermt save;

3. Using as $LUNID the serial number provided by Storage team.

# powermt display dev=all|grep -E "Pseudo|Logical"|sed -e :a | grep -2 $LUNID

4. If you're using VXVM:

# vxdctl enable; vxdisk scandisks;

............................................................................
Note: Probably you don't have the HP tools propertly configured, in that case you could run:

echo 1 > /sys/class/fc_host/host0/issue_lip
echo "- - -" > /sys/class/scsi_host/host0/scan
echo 1 > /sys/class/fc_host/host1/issue_lip
echo "- - -" > /sys/class/scsi_host/host1/scan

# powermt config;
# powermt save;
# vxdctl enable;
# vxdisk scandisks;

Disk capacity Review on UNIX servers

Order files by size on the File system "."

# find . -xdev -ls | awk '{print $7 " "$11}' | sort -rn | more

Which is the lastest modified file.

# ls -ltr

Find files larger than +5000 bytes

# find . -xdev -size +5000 -print
# find . -xdev -size +5000 -exec ls -l {} ";"

Find files according its size.

# du /bin/* | sort -nr

Find larger files

# find . -xdev -ls | awk '{print $7 " "$11}' | sort -rn | more

(reemplazar el / con el path, sino el find corre por todos lados