WebSphere Issues

09/02/2010

Archive a directory using tar with current date

Filed under: Linux, Scripts, WAS, WebSphere Portal — Ishtiaque @ 9:43 am

1. Backup “WebSphere” directory:

  • tar -C /opt/IBM -zpcvf /tmp/WebSphere.tar.gz  WebSphere
  • tar -tvf /tmp/WebSphere.tar.gz

2. Restore “WebSphere” directory:

  • mv /opt/IBM/WebSphere /opt/IBM/WebSphere_org (Note: Before restoring rename existing WebSphere directory)
  • tar -C /opt/IBM -pxvf /tmp/WebSphere.tar.gz
  • diff -r /opt/IBM/WebSphere /opt/IBM/WebSphere_org (Compare files between restored and original directory)

Following script can be used to automate the backup process of WebSphere directory:

#!/bin/bash

DIR=WebSphere
PARENT_DIR=/opt/IBM
DATE=`date +%d%m%y`
ARCHIVE=/tmp/$DIR.$DATE.tar.gz

echo Archiving $PARENT_DIR/$DIR directory into $ARCHIVE
tar -C $PARENT_DIR -zpcvf $ARCHIVE $DIR

 

Advertisements

Leave a Comment »

No comments yet.

RSS feed for comments on this post. TrackBack URI

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Create a free website or blog at WordPress.com.

%d bloggers like this: