IWETHEY v. 0.3.0 | TODO
1,095 registered users | 0 active users | 0 LpH | Statistics
Login | Create New User
IWETHEY Banner

Welcome to IWETHEY!

New I done gots this shell script... for backing up...
You see, this company want a backup script that at least verifies the last file on a tape is accessable.

So I have created a script that creates a hyarge tgz... then verifies that tgz as at least able to read completely through, then write it to tape. Then restores from tape and tests for the last file again.

No error control... as they want it to be all e-mail notification.

So the real question, am I missing something? or is it good. It has been anonymized for your prtection.
#!/bin/bash\nPATH=/usr/sbin:/usr/bin:/sbin:/bin\n\n# Values used throughout the script\nBASE="exports"\nSRC="/imports/datalocation"\nTAPE="/dev/tape"\nDATE=`/bin/date +%Y%m%d`\nDAY=`/bin/date +%A`\nTAR="/bin/tar"\nMAIL="/usr/bin/mail"\nECHO="/bin/echo"\nMKDIR="/bin/mkdir"\nCAT="/bin/cat"\nMT="/bin/mt"\nRM="/bin/rm"\nFILE="data/last-file-on-tape"\nTESTING="$BASE/$DAY/testing"\nFIRST="$TESTING/first"\nSECOND="$TESTING/second"\nINFO="/$BASE/$DAY/$DATE.info"\nRECIPIENTS="greg@gregfolkert.net"\n\nTIME=`/bin/date +%c`\n$ECHO "Starting... Data Backup at: $TIME" > $INFO 2>&1\n$ECHO "using $DAY/$DATE.tgz and $DAY/$DATE.info" >> $INFO 2>&1\n\nTIME=`/bin/date +%c`\n$ECHO "Began archive creation at: $TIME" >> $INFO 2>&1\n$CAT $INFO | $MAIL -s"$DATE ARCHIVE STARTED" $RECIPIENTS\ncd $SRC\n$TAR --totals -zcvf /$BASE/$DAY/$DATE.tgz * >> /$BASE/$DAY/$DATE.idx 2>>$INFO\n\nTIME=`/bin/date +%c`\n$ECHO "Ended archive creation at: $TIME" >> $INFO 2>&1\n$CAT $INFO | $MAIL -s"$DATE ARCHIVE CREATED" $RECIPIENTS\n\nTIME=`/bin/date +%c`\n$ECHO "Began archive testing at: $TIME" >> $INFO 2>&1\n$MKDIR $TESTING\n$MKDIR $FIRST\ncd $FIRST\n$TAR zxf /$BASE/$DAY/$DATE.tgz $FILE >> $INFO 2>&1\n\nTIME=`/bin/date +%c`\n$ECHO "Ended daily archive testing at: $TIME" >> $INFO 2>&1\n$CAT $INFO | $MAIL -s"$DATE ARCHIVE TESTED" $RECIPIENTS\n\nTIME=`/bin/date +%c`\n$ECHO "Began writing $DAY/$DATE.tgz to TAPE at: $TIME" >> $INFO 2>&1\ncd /$BASE/$DAY\n$TAR --totals -cf $TAPE $DATE.tgz >> $INFO 2>&1\n\nTIME=`/bin/date +%c`\n$ECHO "Ended writing $DAY/$DATE.tgz to TAPE at: $TIME" >> $INFO 2>&1\n$CAT $INFO | $MAIL -s"$DATE ARCHIVE WRITTEN TO TAPE" $RECIPIENTS\n\nTIME=`/bin/date +%c`\n$ECHO "Began restoring $DAY/$DATE.tgz to $SECOND at: $TIME" >> $INFO 2>&1\n$MKDIR $SECOND\ncd $SECOND\n$TAR xf $TAPE $DATE.tgz >> $INFO 2>&1\n\nTIME=`/bin/date +%c`\n$ECHO "Ended restoring $DAY/$DATE.tgz to $SECOND at: $TIME" >> $INFO 2>&1\n$CAT $INFO | $MAIL -s"$DATE ARCHIVE RESTORED FROM TAPE" $RECIPIENTS\n\nTIME=`/bin/date +%c`\n$ECHO "Began extracting test file from $DAY/$DATE.tgz at $TIME" >> $INFO 2>&1\n$TAR zxf $DATE.tgz $FILE >> $INFO 2>&1\n\nTIME=`/bin/date +%c`\n$ECHO "Ended testing/extracting $DAY/$DATE.tgz at $TIME" >> $INFO 2>&1\n$CAT $INFO | $MAIL -s"$DATE ARCHIVE TESTED" $RECIPIENTS\n\n$MT offline\n$ECHO "Cleaning up verify/testing files at: $TIME" >> $INFO 2>&1\n$RM -rf $TESTING\n\nTIME=`/bin/date +%c`\n$ECHO "WAMGR backup procedure ended $TIME" >> $INFO 2>&1\n$CAT $INFO | $MAIL -s "$DATE BACKUP COMPLETED" $RECIPIENTS


Thanks in advance... reason I ask, is it fails. But the one with only the day and date substitution works... grrr.

Let me know.
--
[link|mailto:greg@gregfolkert.net|greg],
[link|http://www.iwethey.org/ed_curry|REMEMBER ED CURRY!] @ iwethey

Gawd I hate backups...
New cornfused
it looks like you are banging out a mail message at each step, why not build a file then pipe to mail? and also where is the node/leaf value of exports, is it independent of the path?
thanx,
bill
"You're just like me streak. You never left the free-fire zone.You think aspirins and meetings and cold showers are going to clean out your head. What you want is God's permission to paint the trees with the bad guys. That wont happen big mon." Clete
questions, help? [link|mailto:pappas@catholic.org|email pappas at catholic.org]
New The Maize grows....
Yes, they want an e-mail to go out every time a step is done.

Everything except the files list (which goes to /$BASE/$DAY/$DATE.idx) goes to $INFO (== /$BASE/$DAY/$DATE.info) I then cat this and pipe it to /usr/bin/mail and send with subject to recipients.

The exports are "/exports/Monday, /exports/Tuesday, /exports/Wednesday, /exports/Thursday, /exports/Friday, /exports/Saturday, /exports/Sunday, /exports/Misc"

Each is a dedicated 200GB setup. I create store and test the .tgz according to the Day of the Week. Right now the backup of 22GB of data (results in ~4.3GB TGZ)... works just fine... and they get to take a tape home every night. Each tape has been verified and tested.
--
[link|mailto:greg@gregfolkert.net|greg],
[link|http://www.iwethey.org/ed_curry|REMEMBER ED CURRY!] @ iwethey

[corny, dull-witted saying inserted here]
New How does it fail?
--

Less Is More. In my book, About Face, I introduce over 50 powerful design axioms. This is one of them.

--Alan Cooper. The Inmates Are Running the Asylum
New It fails by...
not executing every line...

but then lines that start out the same way... run.

Suxxors.
--
[link|mailto:greg@gregfolkert.net|greg],
[link|http://www.iwethey.org/ed_curry|REMEMBER ED CURRY!] @ iwethey

[insert saying here] No... not today... I am all out of them.
New What lines are missed?
And what does it mean to "start out the same way"?
--

Less Is More. In my book, About Face, I introduce over 50 powerful design axioms. This is one of them.

--Alan Cooper. The Inmates Are Running the Asylum
New I done found the error....
Farking me and my big Ideas...

Simple fix really.

I needed to add slashes to my mkdir commands.

GAH Bad Greg... Bad.
--
[link|mailto:greg@gregfolkert.net|greg],
[link|http://www.iwethey.org/ed_curry|REMEMBER ED CURRY!] @ iwethey

DUHHHHH.
New /me grins "guilty meself"
"You're just like me streak. You never left the free-fire zone.You think aspirins and meetings and cold showers are going to clean out your head. What you want is God's permission to paint the trees with the bad guys. That wont happen big mon." Clete
questions, help? [link|mailto:pappas@catholic.org|email pappas at catholic.org]
     I done gots this shell script... for backing up... - (folkert) - (7)
         cornfused - (boxley) - (1)
             The Maize grows.... - (folkert)
         How does it fail? -NT - (Arkadiy) - (4)
             It fails by... - (folkert) - (3)
                 What lines are missed? - (Arkadiy) - (2)
                     I done found the error.... - (folkert) - (1)
                         /me grins "guilty meself" -NT - (boxley)

Then again, I think our walls are made from the salvaged hulls of exotic alien spacecraft so YMMV.
50 ms