Linux / UNIX Tech Support Forum
This is a discussion on backup using tape within the Novell Suse / OpenSuse forums, part of the Linux Distribution category; hi i need to make some scripts: 1) a script that will add an zip archive each week to a ...
Register free or login to your account to remove all advertisements.
|
|||||||
| Novell Suse / OpenSuse Discussion about Novell Linux or OpenSuse Linux related problems. |
![]() |
|
|
Thread Tools | Display Modes |
|
|||
|
hi
i need to make some scripts: 1) a script that will add an zip archive each week to a tape. 2) a script that will tell when there is no room on the tape to put archives 3) a script that will search/extract a specific archive from that tape, when requested. can you help me, please ? i'm quite a newbie on scripting. I tried 2 times for script no 1), but none of it seems to work right because when i try to extract, nothing is where it sould be or cannot be extracted. These are my scripts: counter - is a file in my scripts directory where i store the backup track number on tape mailul - is a file in my scripts directory where i store mail body to be sent TRY no 1: #!/bin/sh #-- Declarare variabile---------------------------- data=`date +%d-%m-%Y`; cale=/BACKUP; src=/home/journaling/Maildir/cur t=`cat counter`; num_file=$data-$t #-- Arhivare ------------------------------------ /usr/bin/zip -r -P password /BACKUP/$num_file.zip $src count=0 #-- First time backup ---------------------------- if [ $t -eq 1 ]; then echo " S-a creat arhiva $num_file.zip " >> $cale/mailul; echo " Initializez primul backup pe banda " >>$cale/mailul; mt -f /dev/st0 tell; nice -19 dd if=$cale/$num_file.zip of=/dev/nst0; mt -f /dev/st0 weof 1; >counter; echo "1" >> counter; echo " In data `date +%d-%m-%y` ,ora `date +%T` backup created " >> $cale/mailul #-- Next time backup ---------------------------- else mt -f /dev/nst0 eod; nice -19 dd if=$cale/$num_file.zip of=/dev/nst0; echo " In data `date +%d-%m-%y` ,ora `date +%T` backup $t created on tape " >> $cale/mailul (( t += 1 )); mt -f /dev/st0 weof $t; >counter; echo "$t" >> counter; fi #-- Send mail, create log ----------------------------------- cat $cale/mailul| mail mymail@mydomain -s "Journaling BACKUP" cp $cale/mailul $cale/log-$num_file #-- empty mail body ---------------------------------------- >mailul TRY no. 2: #!/bin/sh #-- Declarare variabile ------------------------------------------------ data=`date +%d-%m-%Y`; cale=/BACKUP; t=`cat counter`; #-- Lock sa nu se suprapuna backup-urile ------------------------------ if [ -f /tmp/backup.lock ]; then echo "locked!" exit; fi date>/tmp/disk_to_tape.lock #-- Arhivare----------------------------------------------------- /usr/bin/zip -r -P password /BACKUP/$data.zip /home/costin count=0 #-- Primul backup de pe banda ----------------------------------- if [ $t -eq 0 ]; then for f in $data; do echo " S-a creat arhiva $data.zip " >> $cale/mailul; echo " Banda este goala, initializez primul backup " >>$cale/mailul; nice -19 tar cf /dev/nst0 /BACKUP/$data.zip; mt -f /dev/st0 weof 1; >counter; echo 1 >> counter; done if [ $count -eq 1 ]; then echo " In data `date +%d-%m-%y` ,ora `date +%T` s-a realizat backup-ul si a fost mutat pe tape drive " >> $cale/mailul else >mailul; echo " Verifica banda, nu s-a efectuat backup-ul ! " >> $cale/mailul; echo " `date +%d-%m-%y` " >> $cale/mailul; echo " `date +%T` " >> $cale/mailul; fi #-- Backup-uri adaugate pe banda ------------------------------------ else for f in $data; do echo $count >> $cale/mailul; echo "Adaug backup-ul $t pe banda existenta" >> $cale/mailul mt -f /dev/nst0 eom; nice -19 tar cf /dev/nst0 /BACKUP/$data.zip; (( t += 1 )); mt -f /dev/st0 weof $t; (( count += 1)); >counter; echo "$t" >> counter; done if [ $count -eq 1 ]; then echo " In data `date +%d-%m-%y` ,ora `date +%T` s-a realizat backup-ul si a fost mutat pe tape drive " >> $cale/mailul else >mailul; echo " Verifica banda, nu s-a efectuat backup-ul ! " >> $cale/mailul; echo " `date +%d-%m-%y` " >> $cale/mailul; echo " `date +%T` " >> $cale/mailul; fi fi #-- Remove lock, send mail, create log ---------------------------- rm -f /tmp/disk_to_tape.lock cat $cale/mailul| mail mymail@mydomain -s "Journaling BACKUP" cp $cale/mailul $cale/log-$data #-- golire fisier de mail pentru urmatoarea operatie --------------- >mailul |
|
||||
|
Please do not post same message twice. See your first thread.
__________________
Vivek Gite |
![]() |
|
|
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) |
|
| Thread Tools | |
| Display Modes | |
|
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| HP DAT 72 tape drive not recognized | Dano | Ubuntu / Debian | 12 | 30th October 2009 01:09 PM |
| Fedora Linux Tape Drive Device Name and Backup Commands | madmacher | Linux software | 1 | 27th November 2008 10:57 PM |
| tar tape command example | tom | Getting started tutorials | 0 | 5th June 2007 09:36 AM |
| UNIX list a backup tape contents | chiku | Getting started tutorials | 0 | 27th April 2007 04:46 PM |
| Openbsd Howto backup data on tape - tutorial | raj | All about FreeBSD/OpenBSD/NetBSD | 1 | 20th December 2006 01:44 AM |