Sponsored Content
Full Discussion: Backup of today's file
Top Forums Shell Programming and Scripting Backup of today's file Post 302165532 by namishtiwari on Friday 8th of February 2008 05:40:36 AM
Old 02-08-2008
Backup of today's file

Hiii,

Here is the part o fmy script-
Code:
for file in $FileList
        do
                if [[ $(ls -l $file 2>/dev/null) = *$today* ]];
                then
                        echo "Skips $file file. It is todays file"
                        if [[ $isBackup -eq 1 ]];then
                            cp $file $BackupLocation 2>/dev/null
                            cat /dev/null >$file
                        fi
                        continue
                fi

                if [[ $isBackUp -eq 1 ]]
                then
                        mv $file $BackupLocation 2>/dev/null
                        #cat /dev/null > $file
                else
                        rm $file $BackupLocation 2>/dev/null
                        #cat /dev/null >$file
                fi
        done
fi

The problem exists in the today's file,i need to take the backup of the today's file also and then make the content 0 of that file,but what i have writen is not doing so,can you guys give me some suggestion how i can do that.I need a quick response guys,stucked in between.If you have any doubt regarding the question then let me know i will try to clarify it.

Thanks

Last edited by namishtiwari; 02-08-2008 at 07:02 AM..
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Check backup file size on backup tape

Hi, I performed backup on tape and I want to append more files to my previous backup on the same backup tape. But before I do that I need to know the backup file size of the first backup I performed so that I know the available size on the backup tape. Can someone help me what command I will use... (0 Replies)
Discussion started by: ayhanne
0 Replies

2. Shell Programming and Scripting

Files with 0 file size and created today

hi, I am building a script to identify those files created/modified today and with file size 0. I am able to find the files with 0 file size and created/modified in last 24 hrs as shown below but not today (current date), I tried using (touch -t time filenm) but in my version of unix at work it... (7 Replies)
Discussion started by: rushs682
7 Replies

3. UNIX for Advanced & Expert Users

backup a file and keep every version of the backup

I am trying to backup my .bash_history and I want to keep every version of the backup. I am thinking to put one of these in my crontab. 0 0 * * 0,3 cat .bash_history > boo 0 0 * * 0,3 cp .bash_history boo I would like the backups to be called boo1, boo2, boo3, etc. I would like to keep... (7 Replies)
Discussion started by: cokedude
7 Replies

4. Shell Programming and Scripting

check file exists and created today issue

Morning My other issue I have seems very simple but im just not seeing it. I have a script that checks on a remote share to see if the backups for some systems have run. Its as simple as: find /mnt/ukwcs-net-config/WLAN-Controllers/ -mtime -1 -ls | egrep '(cfg)' > wlanlog.txt cut -c 1-92... (4 Replies)
Discussion started by: ltodd2
4 Replies

5. Shell Programming and Scripting

rsync backup mode(--backup) Are there any options to remove backup folders on successful deployment?

Hi Everyone, we are running rsync with --backup mode, Are there any rsync options to remove backup folders on successful deployment? Thanks in adv. (0 Replies)
Discussion started by: MVEERA
0 Replies

6. Shell Programming and Scripting

getting timestamp of a file and if it was accessed today then finding a line in it

i have my files and the variables value extracted from db is taken as in1=slot0312 in2=best in3=it is :veryliong/fine as varibles.. i have a folder stuctures in my unix machine as : /2011/hand_sl0312/best/HOD/file1.txt /2011/hand_sl0312/happy/HOD/file1.txt... (1 Reply)
Discussion started by: rajniman
1 Replies

7. Shell Programming and Scripting

meaning of today=${1:-${today}}

what does today=${1:-${today}} mean??? I saw a script which has these two lines: today=`date '+%y%m%d'` today=${1:-${today}} but both gives the same value for $today user:/export/home/user>today=`date '+%y%m%d'` user:/export/home/user>echo $today 120326... (2 Replies)
Discussion started by: Vidhyaprakash
2 Replies

8. UNIX for Advanced & Expert Users

Script to rename file that was generated today and which starts with date

hello, can someone please suggest a script to rename a file that was generated today and filename that being generated daily starts with date, its a xml file. here is example. # find . -type f -mtime -1 ./20130529_4995733057260357019.xml # this finename should be renamed to this format.... (6 Replies)
Discussion started by: bobby320
6 Replies

9. Shell Programming and Scripting

Help Needed for creating the folder by checking today's date and, take backup using rsync command

How to create a shell script to create a folder by using the today's date to take backup using rsync command on every evening around 7 pm. Kindly help. Thanks. To be more precise, I want to create a script which matches the today's date with server's date format, if matches then creates the... (2 Replies)
Discussion started by: bakula10
2 Replies

10. UNIX for Beginners Questions & Answers

Find and copy .zip file based on today's date

Hi Team, I'm new to unix and i have a requirement to copy or move files from one directory to another based on current date mentioned in the .zip file name. Note that i need to copy only the recent zip file. please help me with the code i tried the code as: #! /usr/bin/sh find... (3 Replies)
Discussion started by: midhun3108
3 Replies
pipebench(1)															      pipebench(1)

NAME
pipebench - Shows speed of stdin/stdout communication SYNOPSIS
pipebench [ -ehqQIoru ] [ -s file | -S file ] [ -b bufsize ] DESCRIPTION
Measures the speed of stdin/stdout communication. OPTIONS
-h Displays a help message and exits. -e If an error occurs, exit (breaking the pipe between stdin and stdout. By default an error message is printed to stderr and the pro- gram continues. -q Only show summary stats. -Q Don't show running speed or summary stats. Same as -q -o. Can be used to play with buffer size. -o Don't show summary. -b bufsize Use this buffer size, in bytes. -r Just show raw speed, no fancy stuff. And no summary. -s file Write status to file instead of stderr. -S file Write status to file instead of stderr. -I Use 1kB = 1000B, instead of the default 1024B. -u Don't convet to units (kilo, Mega, etc...) EXAMPLES
Benchmark and show progress of backup # (cd /home/; tar cf - .) | pipebench | (cd /mnt/backup/; tar xf -) A number to brag to your friends about $ dd if=/dev/zero bs=80k count=60k 2> /dev/null | ./pipebench -q > /dev/null BUGS
No known bugs... yet. SEE ALSO
dd(1), cat(1) AUTHOR
Pipebench was written by Thomas Habets <thomas@habets.pp.se> pipebench 18th Apr, 2003 pipebench(1)
All times are GMT -4. The time now is 12:27 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy