Monday, April 6, 2009

Remote System service tag

1. Get DELL Service Tag on remote Windows system
Login to the Windows remote-host using VNC or remote desktop connection. Use WMIC on Windows to get service tag as shown below.

C:\>wmic bios get serialnumber
SerialNumber
ABCDEF1Following WMIC command will give make and model number along with service tag.

C:\>wmic csproduct get vendor,name,identifyingnumber
IdentifyingNumber Name Vendor
ABCDEF1 PowerEdge 2950 Dell Inc.If VNC or remote desktop connection to the remote-host is not available, execute the following from the local-host to get the service tag of the remote-host.

C:\>wmic /user:administrator /node:remote-host bios get serialnumber
SerialNumber
ABCDEF1
[Note: Replace remote-host with the machine name of your remote-host.]

2. Get DELL Service Tag on remote Linux system
Login to the Linux remote-host using SSH. Use dmidecode on Linux to get service tag as shown below

# /usr/sbin/dmidecode
# dmidecode -s system-serial-number

Wednesday, April 1, 2009

Incremental backup using tar

#!/bin/bash
# Umaknta Samantaray
# Date 20/02/2009
# This script will keep backup of home directory on sunday and incremental on other days. Delete the 14 days files daily.
# mount -t smbfs //172.16.66.116/unixbackup /mnt/samba/ -o rw,username=usamantaray/flagstonere,gid=users,dmask=777,fmask=777
# /home/usamantaray/MYSCRIPTS/mysqldbbackup.sh

fullbackup() {
cat /dev/null > ${BACKUPDIR}/incriment.snapshot
tar -g ${BACKUPDIR}/incriment.snapshot -zcf ${BACKUPDIR}/${NEWDIR}${1}.home.tz $SDIR/${1}
}
incrimbackup() {
tar -g ${BACKUPDIR}/incriment.snapshot -zcf ${BACKUPDIR}/${NEWDIR}${1}.home.incr.tz $SDIR/${1}
}

DATE=`date +%Y%m%d`
NEWDIR=`hostname -s`.$DATE.home
BACKDIR=/export/backup
SDIR=/export/home

USERNAME=(`ls -1 ${SDIR}`)
#USERNAME=(`cd ${SDIR} && find . -maxdepth 1 -type d \! -name . | cut -d / -f 2`)
cd ${BACKDIR} && find ${BACKUPDIR} -maxdepth 1 -name '2[0-9][0-9][0-9][0-9][0-9][0-9][0-9]'\
-type d -mtime +14 -exec rm -rf {} \;

for n in "${USERNAME[@]}"; do

if [ "`date +"%a"`" = "Sun" ] ; then
fullbackup $n
else
incrimbackup $n
fi
done

exit