![]() |
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Insert file names when concatenate files into a file | samky2005 | Shell Programming and Scripting | 2 | 06-05-2009 07:07 PM |
| find locked files, print file path, unlock file | alternapop | UNIX for Dummies Questions & Answers | 0 | 04-14-2009 09:09 PM |
| ls > file - Creating file containing the list of all files present in a directory | pranavagarwal | Shell Programming and Scripting | 1 | 09-26-2008 09:37 PM |
| listing files excluding files from control file | ukatru | UNIX for Advanced & Expert Users | 15 | 08-15-2008 09:24 PM |
| total number of files which have "aaa" in files whose names are File*_bbb* | sudheshnaiyer | UNIX for Dummies Questions & Answers | 1 | 08-16-2007 03:34 PM |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
||||
|
zip all of files except last file
hi, I try to write a script to zip archivelog files in arch fold except not zip last archivelog file since it database may be still using the last file
here is my script. when I run the script, I get error messages. could you please advise/correct my script in detail what it could be wrong, I am not expert for shell script, it could be simple mistake, but just don't know. thanks very much for your help. jack here is my script: ORACLE_SID="vprod" BACK_DIR=`/oraappl/pca/backups` export ORACLE_SID BACK_DIR program=`basename $0` DBAPAGE="/oraappl/pca/vprod/vprodscr/bin/dba_pager.ksh" $DBAPAGE "$program:$ORACLE_SID:start" "Starting archivelog backup at `date` for $ORACLE_SID" LOGFILE=$BACK_DIR/nightly_offsite/log/${ORACLE_SID}_archbackup.log BCKFILE=$BACK_DIR/nightly_offsite/${ORACLE_SID}_arch.`date +%m%d%y`.gz echo "Archive log backup for $ORACLE_SID on `date` started" ALLLOGS=`ls -rt` LASTLOG=`echo "$ALLLOGS" |tail -1` SECONDLASTLOG=`echo "$ALLLOGS" |tail -2 | head -n 1` echo "First log is: "`echo "$ALLLOGS" | head -n 1` echo "Second Last log is : "`echo "$ALLLOGS" |tail -2 | head -n 1` echo "Exclude Last log is : "`echo "$ALLLOGS" |tail -1` echo "Command is: /usr/local/bin/gtar -zcvf $BCKFILE" $ALLLOGS "-X" $LASTLOG find $BACK_DIR/nightly_offsite -name "${ORACLE_SID}_arch*" -depth -type f -mtime +5 -exec rm {} \; /usr/local/bin/gtar -zcvf $BCKFILE $ALLLOGS -X $LASTLOG echo "Archive log backup for $ORACLE_SID on `date` completed" $DBAPAGE "$program:$ORACLE_SID:end" "Ending archivelog backup at `date` for $ORACLE_SID" exit here is the error message when I run above script: $ . ./archbackup.ksh basename $0:vprod:start Starting archivelog backup at 'date' for vprod Archive log backup for vprod on 'date' started Frist log is: echo "$ALLLOGS" | head -n 1 Second Last Log is: echo "$ALLLOGS" |tail -2 |head -n 1 Exclude Last Log is: echo "$ALLLOGS" |tail -1 Command is: gtar -zcvf /oraappl/pca/backups/nightly_offsite/vprod_arch.date +%m%d%y.gz ls -rt -X each "$ALLLOGS" |tail -1 gtar: +%m%d%y.gz: Cannot stat: No such file or directory gtar: ls: Cannot stat: No such file or directory gtar: -rt: Cannot stat: No such file or directory gtar: -X: Cannot stat: No such file or directory gtar: each: Cannot stat: No such file or directory gtar: "$ALLLOGS": Cannot stat: No such file or directory gtar: |tail: Cannot stat: No such file or directory gtar: -1: Cannot stat: No such file or directory gtar: Error exit delayed from previous errors Archive log backup for vprod on 'date' completed basename $0:vprod:end Ending archivelog backup at 'date' for vprod $ |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|