Sponsored Content
Full Discussion: Backup files per Date String
Top Forums Shell Programming and Scripting Backup files per Date String Post 302188531 by jim mcnamara on Wednesday 23rd of April 2008 05:31:58 PM
Old 04-23-2008
start with this:
Code:
#!/bin/ksh
# print day of week
dow()
{
        perl -e '
                use POSIX qw(strftime);
                $fmt = "%A";  # %a = abbreviated weekday %u = weekday number
                $mday = substr("$ARGV[0]", 8, 2);
                $mon =  substr("$ARGV[0]", 5 ,2);
                $year = substr("$ARGV[0]", 0 ,4);
                $weekday =
                  strftime($fmt, 0, 0, 0, $mday , $mon - 1, $year - 1900, -1, -1, -1);
                print "$weekday";
                ' "$1"
}

for file in $( ls *.tar.gz )
do

      dt=$( echo $file | awk -F'-' { printf("%s-%s-%s", $2, $3, $4)}' )
      day=$( dow $dt )
      if [[ $day = "Sun" ]] ; then
      # do backup here 
      fi
done

 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Backup Date & Time

:confused: I'm not really sure about the default backup date & time in our Unix system and I would like to change it to a convienient time...how do I do that? Please help? (1 Reply)
Discussion started by: EbeyeJJ
1 Replies

2. Shell Programming and Scripting

backup of files for a specific date

I want to write script for backing up archive logs files for specific date. please give me idea for that. (2 Replies)
Discussion started by: akm9999
2 Replies

3. Filesystems, Disks and Memory

backup of files for a specific date

In Linux Advance server I want to write one script for backing up files for a specific date like 24/07/2008. (3 Replies)
Discussion started by: akm9999
3 Replies

4. Homework & Coursework Questions

Date comparison with 'string date having slashes and time zone' in Bash only

1. The problem statement, all variables and given/known data: I have standard web server log file. It contains different columns (like IP address, request result code, request type etc) including a date column with the format . I have developed a log analysis command line utility that displays... (1 Reply)
Discussion started by: TariqYousaf
1 Replies

5. Shell Programming and Scripting

How to backup latest date files?

Hi, I have below two situations to handle, 1. I have list of files with file names having date&time. I have to backup to old date files. say I have below files in a directory, 1. XX123_20101004010101.dat 2. XX124_20101004010201.dat 3. XX121_20101003010101.dat 4.... (6 Replies)
Discussion started by: smr_rashmy
6 Replies

6. Shell Programming and Scripting

mv files add date string

I have a requirement where I need to move files that are being written too. I am unable to use sed since I believe this will stop the files from getting written. There is a directory containing about 50 unique files, the date is the same on all of them. I need to change the date string on each... (1 Reply)
Discussion started by: jaysunn
1 Replies

7. Shell Programming and Scripting

Faster Line by Line String/Date Comparison of 2 Files

Hello, I was wondering if anyone knows a faster way to search and compare strings and dates from 2 files? I'm currently using "for loop" but seems sluggish as i have to cycle through 10 directories with 10 files each containing thousands of lines. Given: -10 directories -10 files... (4 Replies)
Discussion started by: agentgrecko
4 Replies

8. Shell Programming and Scripting

Find and copy files based on todays date and search for a particular string

Hi All, I am new to shell srcipting. Problem : I need to write a script which copy the log files from /prod/logs directory based on todays date like (Jul 17) and place it to /home/hzjnr0 directory and then search the copied logfiles for the string "@ending successfully on Thu Jul 17". If... (2 Replies)
Discussion started by: mail.chiranjit
2 Replies

9. Shell Programming and Scripting

How to list files that are not first two files date & last file date for every month-year?

Hi All, I need to find all files other than first two files dates & last file date for month and month/year wise list. lets say there are following files in directory Mar 19 2012 c.txt Mar 19 2012 cc.txt Mar 21 2012 d.txt Mar 22 2012 f.txt Mar 24 2012 h.txt Mar 25 2012 w.txt Feb 12... (2 Replies)
Discussion started by: Makarand Dodmis
2 Replies

10. Shell Programming and Scripting

Extract count of string in all files and display on date wise

Hi All, hope you all are doing well! I kindly ask you for shell scripting help, here is the description: I have huge number of files shown below on date wise, which contains different strings(numbers you can say) including 505001 and 602001. ... (14 Replies)
Discussion started by: VasuKukkapalli
14 Replies
BACKUP_INTERACTIVE(8)					       AFS Command Reference					     BACKUP_INTERACTIVE(8)

NAME
backup_interactive - Enters interactive mode SYNOPSIS
backup [interactive] [-localauth] [-cell <cell name>] [-help] backup [i] [-l] [-c <cell name>] [-h] DESCRIPTION
The backup interactive initiates an interactive session for issuing backup commands. As indicated in the syntax statement, the operation code (interactive) is optional. Several features of interactive mode distinguish it from regular mode: o In interactive mode, the "backup"> prompt replaces the system (shell) prompt. The operator enters only a command's operation code (omitting the command suite name, backup). o If the -localauth flag or the -cell argument is included on the backup interactive command, the settings apply to all commands issued during that interactive session. The issuer does not need to type them on every command. Another consequence is that the flag and argument do not appear in the syntax statement generated by the help subcommand or -help flag on an individual command issued at the "backup"> prompt. o The backup jobs and backup kill commands are available only in interactive mode. It is not possible to track and terminate backup operations as cleanly in non-interactive mode. o It is not necessary to enclose strings that include metacharacters in double quotes or other delimiters. o The backup command interpreter establishes a connection to the Backup Server, Volume Server and Volume Location (VL) Server processes as it enters interactive mode, and uses the same connection for all commands during the session. Execution time can therefore be faster than in non-interactive mode, in which the command interpreter must establish a new connection for each command. To exit an interactive session, issue the backup quit command. OPTIONS
-localauth Constructs a server ticket using a key from the local /etc/openafs/server/KeyFile file. The backup command interpreter presents it to the Backup Server, Volume Server and VL Server during mutual authentication. Do not combine this flag with the -cell argument. For more details, see backup(8). -cell <cell name> Names the cell in which to run the command. Do not combine this argument with the -localauth flag. For more details, see backup(8). -help Prints the online help for this command. All other valid options are ignored. EXAMPLES
The following example shows how the -localauth flag and -cell argument do not appear when the help dump subcommand is issued in interactive mode. % backup backup> help dump dump: start dump Usage: dump [-volumeset <volume set name>] [-dump <dump level name>] [-portoffset <TC port offset>] [-at <Date/time to start dump>+] [-append ] [-n ] [-file <load file>] [-help ] PRIVILEGE REQUIRED
None. However, backup commands that require privilege in regular mode still require it in interactive mode. SEE ALSO
backup(8), backup_jobs(8), backup_kill(8), backup_quit(8), butc(8) COPYRIGHT
IBM Corporation 2000. <http://www.ibm.com/> All Rights Reserved. This documentation is covered by the IBM Public License Version 1.0. It was converted from HTML to POD by software written by Chas Williams and Russ Allbery, based on work by Alf Wachsmann and Elizabeth Cassell. OpenAFS 2012-03-26 BACKUP_INTERACTIVE(8)
All times are GMT -4. The time now is 11:24 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy