Windows move files "for loop"

Windows Command Line:

for /R c:imusic %i in (*) do move %i c:music

# use %%i in a script or %i on command line

Wedding Playlist

Nothing Like You and I - The Perishers
You're Beautiful - James Blunt
Angel - Sarah McLachlan
Amie - Pure Prairie League
Time In A Bottle - Jim Croce
Silvio - Bob Dylan
Sway - The Perishers
Tones of Home - Blind Melon
Still Crazy After All These Years - Paul Simon
Belief - John Mayer
Proud Mary - CCR
Knockin' on Heaven's Door - Bob Dylan
She Will Be Loved - Maroon 5
Layla - Eric Clapton
Remedy - Seether
Nobody Does It Better - Me First and The Gimme Gimmes
Let There Be Morning - The Perishers
Gravity - John Mayer
I Only Want To Be With You - Me First and The Gimme Gimmes
Right Here - Staind
I'll Be Your Baby Tonight - Bob Dylan
Is It My Body - Alice Cooper
WHEN I'M 64 - THE BEATLES
DON'T KNOW WHY - NORAH JONES
EVERYTHING CHANGES - STAIND
I WANT YOU - BOB DYLAN
EVERY BREATH YOU TAKE - STING
A WHISPER - COLDPLAY
WONDER - NATALIE MERCHANT
CONSTANT CRAVING - KD LANG
NOTHING COMPARES 2 U - ME FIRST AND THE GIMME GIMMES
HIGH - JAMES BLUNT
GREEN EYES - COLDPLAY
JOHNNY B. GOODE - BO DIDDLEY
YOU DON'T MESS AROUND WITH JIM - JIM CROCE
TRUE FINE LOVE - STEVE MILLER BAND
THE GIFT - SEETHER
TEARS AND RAIN - JAMES BLUNT
AT THE ZOO - SIMON & GARFUNKEL
SO COLD (ACOUSTIC) - BREAKING BENJAMIN
DESIRE - U2
BOTHER - STONE SOUR
SUMMER OF 69 - BRYAN ADAMS
SHE'S GOT A WAY - BILLY JOEL
CARNIVAL - NATALIE MERCHANT
I WANNA BE SEDATED - THE RAMONES
I AM THE HIGHWAY - AUDIOSLAVE
NO RAIN - BLIND MELON
SWEET EMOTION - AEROSMITH
CITY OF NEW ORLEANS - ARLO GUTHRIE
RUNAWAY TRAIN - SOUL ASYLUM
SAY IT AIN'T SO - WEEZER
SISTER GOLDEN HAIR - AMERICA
IT'S THE END OF THE WORLD AS WE KNOW IT - REM
PRIDE - U2
HARDER TO BREATHE - MAROON 5

JAZZ PORTION - PLAYED BEFORE THE CEREMONY AND AT THE END OF THE EVENING
JUST THE TWO OF US - GROVER WASHINGTON JR. AND BILL WITHERS
GIANT STEPS - JOHN COLTRANE QUARTET
THEY CAN'T TAKE THAT AWAY FROM ME - SARAH VAUGHAN & HER TRIO
TAKE FIVE - DAVE BRUBECK QUARTET
GROOVIN' HIGH - CHARLIE PARKER; DIZZY GILLESPIE SEXTET
BLUE RONDO A LA TURK - DAVE BRUBECK QUARTET
WHAT A LITTLE MOONLIGHT CAN DO - BILLIE HOLIDAY
STRAIGHT, NO CHASER - THELONIOUS MONK
DOODLIN' - ART BLAKEY & THE JAZZ MESSENGERS
BITTERSWEET - SPYRO GYRA
ST LOUIS BLUES - LOUIS ARMSTRONG
PICK UP STICKS - DAVE BRUBECK QUARTET
BEGIN THE BEGUINE - ARTIE SHAW & HIS ORCHESTRA
WAVE - ROSEMARY CLOONEY
THE VERY THOUGHT OF YOU - BILLIE HOLIDAY
DEAR OLD SOUTHLAND - NOBLE AND HIS ORCHESTRA SISSLE
THE MOOCHE - DUKE ELLINGTON & HIS ORCHESTRA
KATHY'S WALTZ - DAVE BRUBECK QUARTET
GOD BLESS THE CHILD BILLIE HOLIDAY
COTTON TAIL - DUKE ELLINGTON
ONE NOTE SAMBA - ROSEMARY CLOONEY
JUMPIN' AT THE WOODSIDE - COUNT BASIE
MEDITATION - ROSEMARY CLOONEY
SUMMERTIME - BILLIE HOLIDAY

Move users and groups to new server - Linux

On source server:

export UGIDLIMIT=500

mkdir /root/move

awk -v LIMIT=$UGIDLIMIT -F: '($3>=LIMIT) && ($3!=65534)' /etc/passwd > /root/move/passwd.mig

cat /root/move/passwd.mig

awk -v LIMIT=$UGIDLIMIT -F: '($3>=LIMIT) && ($3!=65534)' /etc/group > /root/move/group.mig

cat /root/move/group.mig

awk -v LIMIT=$UGIDLIMIT -F: '($3>=LIMIT) && ($3!=65534) {print $1}' /etc/passwd tee - egrep -f - /etc/shadow > /root/move/shadow.mig

cat /root/move/shadow.mig

use scp or sftp to move backup *.mig and *.gz files over to the new server /tmp directory then delete the *.gz files from the source server to free up space

On the target server:

cd /tmp cat passwd.mig >> /etc/passwd

vi /etc/passwd # to verify things look correct vi passwd.img

cat group.mig >> /etc/group

vi /etc/group

cat shadow.mig >> /etc/shadow vi /etc/shadow

cd / tar -zxvf /tmp/home.tar.gz rm -rf /tmp/home.tar.gz

cd / tar -zxvf /tmp/mail.tar.gz rm -rf /tmp/mail.tar.gz

reboot the server once all files have been verified and are correctly formatted

TWS 8.3 Install

Create Database on Oracle server named TWS with Tablespaces of TWS_DATA and TWS_TEMP

Create user oracle on TWS server

Create user batch on TWS server

Install Oracle 10.2.0.3 on the TWS server - use advanced options to deselect enterprise options and do not create a db

Add the following to /etc/oratab:

dummy:/opt/oracle/product/10.2.0:N

Add the following to the oracle user's .bash_profile:

export ORAENV_ASK=NO; export ORACLE_SID=dummy; . oraenv

Update oracle user environment by running:

$ source .bash_profile

Create a tnsnames.ora file in /apps/oracle/product/10.2.0/network/admin which contains the following:

# TNSNAMES.ORA Network Configuration File: C:oracleora92networkadmintnsnames.ora

# Generated by Oracle configuration tools.

TWS.ORACLESERVERNAME =

(DESCRIPTION =

(ADDRESS_LIST =

(ADDRESS = (PROTOCOL = TCP)(HOST = oracleservername)(PORT = 1521))

)

(CONNECT_DATA =

(SID = TWS)

(SERVER = DEDICATED)

)

)

mkdir /opt/tws

chown batch.batch /opt/tws

Install TWS 8.3

install for user batch

point to TWS.oradev for the database

install path /opt/tws

user system for oracle admin

use batch_tws user for TWS oracle user

enter TWS_DATA for the TWS data tablespace

enter TWS_TEMP for the TWS temp tablespace

Documentation for TWS http://publib.boulder.ibm.com/infocenter/tivihelp/v3r1/index.jsp?toc=/com.ibm.tivoli.itws.doc/toc.xml

Cleanup Commands: do not do in production:

ResetPlan –scratch

StartUp

Get things started after reset (only on a new setup):

JnextPlan

Set limit:

conman

lc ;10

Do a test command job from conman:

sbd “ls”;logon=batch

Do a test script job from conman:

sbf “/path/to/script.sh”;logon=batch

Do this when resetting plan for the day and do not want to extend (if there is a problem)

JnextPlan -for 0000 # To not extend the plan (i.e. just reset for today)

Show schedule

ss

Show jobs

sj

/dev/cdrom does not exist after Linux Restore on VMWare

ln -sF /dev/hda /dev/cdrom

if /mnt/cdrom or /media/cdrom does not exist create it

mount /mnt/cdrom

Sample NetBackup bparchive Script

This script generates a list of informix db backup files to be archived and archives them with netbackup

#!/bin/sh

TEMPF=/tmp/lms_nb_lock

LOG=/apps/informix/9.40/ifx_netbackup.log

# initally check for lock file

if [ -e ${TEMPF} ] ; then

OLD=`find ${TEMPF} -mtime +1`

# ok, lock file exists, is it one day old

echo string is ${OLD}

if [ -z "${OLD}" ] ; then

echo Error, lock file exists, aborting

exit -1

else

# yes the lock file is one day old, remove lock file

echo Error, Removing lock file, please check for runaway bparchive processes mail -s "Informix Netbackup" pvalentino@pvalentino.org

rm -f ${TEMPF}

fi

else

# ok, no lock file , lets run

touch ${TEMPF}

date > ${LOG}

if `onstat -c grep prod1` ; then

FILELIST=/backup_fs/informix/lms_prod1/*prod1_tape*.* && FILES=prodfiles

elif `onstat -c grep inact` ; then

FILELIST=/backup_fs/informix/lms_inact/*inact_tape*.* && FILES=inactfiles

else

FILELIST=/backup_fs/informix/lms_web/*web_tape*.* && FILES=webfiles

fi

for i in `ls $FILELIST`;do

echo "$i" >> /tmp/$FILES

/usr/openv/netbackup/bin/bparchive -S vortex.pvalentino.org -p lmsdb_database_archive -s UserArchive -L /apps/informix/9.40/ifx_netbackup.log -w 0 -f /tmp/$FILES mail -s "`hostname` db netbackup" admin@mydomain.com

rm -f /tmp/$FILES

rm -f ${TEMPF}

done

exit 0

Mount an ISO on Linux

# mkdir /mnt/iso # mount -o loop disk1.iso /mnt/iso

Linux Physical System DR / Restore

Build the base system following using modifications noted here:

a. Disk Partitioning (create minimum of these four partitions):

i. boot (150 MB)

ii. / (1.5GB) Make sure that ‘/boot’ and ‘/’ are on the same physical drive

iii. /restore (At least same size as the original server; see the bridge doc)

iv. /restore/boot (See the bridge doc) Make sure that ‘/restore’ and ‘/restore/boot’ are on the same physical drive

v. Create the swap partition (See bridge doc)

vi. Create any other partitions per the bridge doc

b. Network Setup: (See the bridge doc)

i. Name: (See the bridge doc)

ii. IP: (See the bridge doc)

iii. Mask: (See the bridge doc)

iv. GateWay: (See the bridge doc)

v. DNS: (See the bridge doc)

vi. DNS2: (See the bridge doc)

vii. On Boot: Yes

c. Package Selection

i. Install a minimal package (RHAS 2.1) and the kernel development tools ( RHEL4 / RHEL3 / RHAS 2.1)

Install and configure the net backup client

From the Linux client server download the installation files as follows:

cd /tmp

wget Netbackup5.1/linuxclient.tar

Extract the installation files in /tmp with follwing commands:

tar xvpf linuxclient.tar

Install the NetBackup client into the /usr/openv directory structure with the following:

/bin/sh /tmp/bp/bin/client_config

Verify that the new client has the correct CLIENT_NAME entry in

/usr/openv/netbackup/bp.conf. Edit the bp.conf file if necessary.

Perform an alternate path restore:

d. Restore the system to /restore

build the new kernel

e. Examine /restore/boot/grub/grub.conf and determine the default kernel the system is running with i.e. vmlinuz-2.4.21-47.0.1.ELsmp

f. copy /restore/lib/modules/<DEFAULT KERNEL> directory to /lib/modules for example:

cp -r /restore/lib/modules/2.4.21-47.0.1.ELsmp/ /lib/modules/

g. build the new kernel image to the boot partition

i. cd /lib/modules

ii. uname -r to confirm Kernel Version

iii. mkinitrd /boot/initrd-<Kernel Version>-vmware.img <Kernel Version> i.e. initrd-2.4.21-47.0.1.ELsmp.img

Replace the modules.conf of the restored system with the base systems

h. cp /restore/etc/modules.conf /restore/etc/modules.conf.restore

i. cp /etc/modules.conf /restore/etc/modules.conf

Replace the sysctl.conf of the restored system with the base systems

j. cp /restore/etc/sysctl.conf /restore/etc/sysctl.conf.restore

k. cp /etc/sysctl.conf /restore/etc/sysctl.conf

Edit the grub configuration on the boot partition

l. Open /boot/grub/grub.conf in your favorite editor

m. Edit the existing default stanza changing the name of the kernel initrd image to the new initrd-<Kernel Version>-vmware.img

For example:

title Red Hat Enterprise Linux AS (2.4.21-47.0.1.ELsmp)

root (hd0,0)

kernel /vmlinuz-2.4.21-47.0.1.ELsmp ro root=LABEL=/

initrd /initrd-2.4.21-47.0.1.ELsmp.img

Edit the /restore/etc/fstab file

n. Comment out /restore and /restore/boot partition but do not comment out ‘/boot’ ‘swap’ ‘/’ ‘/mnt/cdrom’ ‘/mnt/floppy’ or any other file systems (like /backupfs) for which you created a physical partition in step 1

For example fstab should similar to following:

LABEL=/ / ext3 defaults 1 1

LABEL=/boot /boot ext3 defaults 1 2

/dev/sdb1 /u01 ext3 defaults 1 3

/dev/sdb2 /u02 ext3 defaults 1 4

/dev/sdc1 /apps ext3 defaults 1 5

/dev/sdd1 /backup_fs ext3 defaults 1 6

LABEL=/u03-logs /u03-logs ext3 defaults 1 7

LABEL=/u04 /u04 ext3 defaults 1 3

none /dev/pts devpts gid=5,mode=620 0 0

none /proc proc defaults 0 0

none /dev/shm tmpfs defaults 0 0

/dev/sda3 swap swap defaults 0 0

/dev/cdrom /mnt/cdrom udf,iso9660 noauto,owner,kudzu,r

o 0 0

/dev/fd0 /mnt/floppy auto noauto,owner,kudzu 0 0

Ora df output example:

/dev/sda2 9.8G 6.3G 3.1G 68% /

/dev/sda1 99M 46M 48M 50% /boot

/dev/sdb1 20G 8.2G 11G 44% /u01

/dev/sdb2 20G 12G 7.0G 63% /u02

/dev/sdc1 7.9G 5.1G 2.5G 68% /apps

/dev/sdd1 30G 9.0G 20G 32% /backup_fs

/dev/sde1 9.9G 1.5G 8.0G 16% /u03-logs

/dev/sdf1 9.9G 6.7G 2.8G 72% /u04

none 1.8G 0 1.8G 0% /dev/shm

o. Change the physical devices for the uncommented mount points to the correct new mount points

i. Where needed replace the labels with the actual names device id’s eg replace LABEL=/ with /dev/sda5 or /dev/ida/c0d0p4

From : LABEL=/ / ext3 defaults 1 1

To: /dev/sda2 / ext3 defaults 1 1

From: LABEL=/boot /boot ext3 defaults 1 2

To: /dev/sda1 /boot ext3 defaults 1 2

Reboot the Server.

Linux on VMWare DR Procedure

On a working VM that has netbackup client installed, create a LUN that is big enough for the required restore.

fdisk the new lun

fdisk /dev/sdX where X is the drive designation i.e. a,b,c,d,.......

Partition the new lun with partitions at least the same size and layout as the original partitions of the failed lun/s. consult fstab file for failed server from backup or documentation for verification:

in fdisk Virtual Disk (SCSI 0:0)type n then p then 1 to create first primary partition as /boot starting at block 1 and ending at +150M

then type n followed by p and so on to create additional primary partitions with sizes required.

Create the swap partition as a primary partition and change type in fdisk with the t option by entering 82 for the type

format partitions with mkfs.ext3 /dev/sdgX where X is the partition number for each partition - do not format the swap partition

Make directories to mount with mkdir /restore for the root i.e.

$ mkdir /restore

$ mount -t ext3 /dev/sdg2 /restore

$ mkdir /restore/boot

$ mount -t ext3 /dev/sdg1 /restore/boot

........ and continue until all required partitions are created and mounted

Perform an alternate path restore with netbackup to the location of your root mount. i.e. /restore on the server you mounted the drives on.

On the VM that you created the LUN to restore to, shutdown the VM and remove the LUN so that it may be mounted by the original VM that required the restore.

Once the LUN has been removed from the recovery server, add the LUN back to the original server through the ESX MUI and not the VMWare client. i.e. go to esx2.pvalentino.org in web browser, select the servername, then click the hardware tab - if there is already a device called Virtual Disk (SCSI 0:0) remove it, then at bottom of page click Add Device and select the device that you restored i.e.

MSA1500_LUN1:servername.vmdk and verify it has a scsi id of 0:0 if it is the boot device.
In the VirtualCenter client add the RHEL3 Update 6 Disk1 iso file as the cdrom device and verify it has power on at boot enabled. Reboot the new VM and hit ESC key to get to the Boot Selection screen (if you miss it just hit CTRL-ALT-INS and try again). Select CD-ROM option 3. Hit TAB key and type linux rescue to boot into rescue mode. Select default options but do not turn on network interfaces for now. If you see error regarding the mount of /mnt/sysimage it is ok to ignore this for now. Click OK and you will get a command prompt. Make /dev/sda1 bootable in fdisk:
> fdisk /dev/sda > a > 1

Make and mount directories:

$ mkdir /restore

$ mount -t ext3 /dev/sda2 /restore

$ mount -t ext3 /dev/sda1 /restore/boot

Change root and label partitions:

$ chroot /restore

$ e2label /dev/sda1 /boot

$ e2label /dev/sda2 /

Exit until system reboots

Hit ESC key and boot to linux rescue from the CD-ROM again.

Linux installation should successfully mount to /mnt/sysimage this time.

Change root, create a /tmp directory, and update the grub configuration:

$ mkdir /tmp

$ chroot /mnt/sysimage

$ grub-install /dev/sda

Exit all the way until reboot and boot to the recovered linux installation

Remove the ISO from the CD-Rom and set to client device.