Sponsored Content
Top Forums Shell Programming and Scripting How many days since a file was modified? Post 302288728 by anandjayaraman on Tuesday 17th of February 2009 11:19:10 PM
Old 02-18-2009
How many days since a file was modified?

I am trying to write a script to backup my laptop to a NAS drive using rsync. I want the backup to be done, only if it has been more than a week since my last backup.

Each time the rsync command executes, I also create a file backuptime.txt file, with the time at which the script completed the job.
date > backuptime.txt

Now, I want to be able to read the backuptime.txt file (or get the modification time of the file), and compare it with the current time/date and see if its greater than 7 days. How do I acomplish this? The only reason why I am creating the file backuptime.txt is to compute elapsed time. If there is a particular format of the date command which would make this task easier, I would gladly use that.

Thanks in advance for your help.

-AJ
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How to zip a modified file 15 days before but not scanning my sub directory files

I am using zip -m option to zip my files, but i dont want my sub directories files to be zipped (1 Reply)
Discussion started by: skrish70
1 Replies

2. UNIX for Dummies Questions & Answers

list last 10 days modified files

All, Is there is anyother single command that will handle ls -lrt | tail -10 Please let me know Thanks, Arun. (1 Reply)
Discussion started by: arunkumar_mca
1 Replies

3. UNIX for Dummies Questions & Answers

how to retrieve original contents of a modified file (modified using vi)

Made changes to a file using vi editor and saved those changes now realised that the changes are not required How can I get the previous version of the file.i.e the one which was there on which I had made changes (3 Replies)
Discussion started by: novice100
3 Replies

4. Shell Programming and Scripting

Modified in last 2 days

I have application log files as below . let say Archiver6 is one app and it has log file as Archiver6.log Archiver6.log.1 Archiver6.log.2 Archiver6.log.3 What i want is whether these log files are not modified in last 2 days for which i am using the below command find . -mtime +2... (1 Reply)
Discussion started by: ali560045
1 Replies

5. Shell Programming and Scripting

How to get a filename modified by attaching modified timestamp

Hi, I want to modify a filename in AIX by attaching the last modified timestamp. I want the timestamp completely in numerical format (eg:200905081210. yr-2009, mnth - 05, date -08, hr - 12, mins - 10). For example if the filename is a.log and it was modified on April 6th 2008 at 21.00. I... (16 Replies)
Discussion started by: Ruks
16 Replies

6. Solaris

List of files last modified 30/60/90 days

Hi, I want to find the list of all the files under a directory (including it's subdirectories) last modified 30 days, 60 days, 90 days..also I want to find out the rate at which the disk space is growing. Please help. (3 Replies)
Discussion started by: b.paramanatti
3 Replies

7. Shell Programming and Scripting

Find the directory modified/created before 4 days

Hi, I have an application which creates some directories while running. I want to delete these directories which are 4 days older. i tried find . type d -mtime +1 -print And it is working fine.. but find . type d -mtime +4 -print is not giving any results which are 4 days... (6 Replies)
Discussion started by: Tuxidow
6 Replies

8. Shell Programming and Scripting

Script to check for the file existence, if file exists it should echo the no of modified days

Hi, I am looking for a shell script with the following. 1. It should check whether a particular file exists in a location #!/bin/sh if ; then echo "xxx.txt File Exists" else echo "File Not Found" fi 2. If file exists, it should check for the modified date and run a command... (2 Replies)
Discussion started by: karthikeyan_mac
2 Replies

9. Shell Programming and Scripting

Working out days of the week and processing file in 3 working days

Hi guys i need advice on the approach to this one...... I have a file say called Thisfile.20130524.txt i need to work out from the date 20130524 what day of the week that was and then process the file in 3 working days. (so not counting saturday or sunday....(will not worry about bank... (2 Replies)
Discussion started by: twinion
2 Replies

10. UNIX for Beginners Questions & Answers

How to find a file that's modified more than 2 days ago but less than 5 days ago?

How to find a file that's modified more than 2 days ago but was modified less than 5 days ago by use of any Linux utility ? (4 Replies)
Discussion started by: abdulbadii
4 Replies
BACKUP_JOBS(8)						       AFS Command Reference						    BACKUP_JOBS(8)

NAME
       backup_jobs - Lists pending and running operations in interactive mode

SYNOPSIS
       jobs [-help]

       j [-h]

DESCRIPTION
       The backup jobs command lists the job ID number and status of each backup operation running or pending in the current interactive session.

       This command can be issued in interactive mode only. If the issuer of the backup interactive command included the -localauth flag, the
       -cell argument, or both, those settings apply to this command also.

       To terminate operations that appear in the output, issue the backup kill command and identify the operation to cancel with the job ID
       number from this command's output.

       To check the status of a Tape Coordinator, rather than of a certain operation, use the backup status command.

OPTIONS
       -help
	   Prints the online help for this command. All other valid options are ignored.

OUTPUT
       The output always includes the expiration date and time of the tokens that the backup command interpreter is using during the current
       interactive session, in the following format:

	  <date>   <time>: TOKEN EXPIRATION

       If the execution date and time specified for a scheduled dump operation is later than <date time>, then its individual line (as described
       in the following paragraphs) appears below this line to indicate that the current tokens will not be available to it.

       If the issuer of the backup command included the -localauth flag when entering interactive mode, the line instead reads as follows:

	  :  TOKEN NEVER EXPIRES

       The entry for a scheduled dump operation has the following format:

	  Job <job_ID>:  <timestamp>:  dump  <volume_set>  <dump_level>

       where

       <job_ID>
	   Is a job identification number assigned by the Backup System.

       <timestamp>
	   Indicates the date and time the dump operation is to begin, in the format month/date/year hours:minutes (in 24-hour format)

       <volume_set>
	   Indicates the volume set to dump.

       <dump_level>
	   Indicates the dump level at which to perform the dump operation.

       The line for a pending or running operation of any other type has the following format:

	  Job <job_ID>:  <operation>  <status>

       where

       <job_ID>
	   Is a job identification number assigned by the Backup System.

       <operation>
	   Identifies the operation the Tape Coordinator is performing, which is initiated by the indicated command:

	   Dump (dump name)
	       Initiated by the backup dump command. The dump name has the following format:

		   <volume_set_name>.<dump_level_name>

	   Restore
	       Initiated by the backup diskrestore, backup volrestore, or backup volsetrestore command.

	   Labeltape (tape_label)
	       Initiated by the backup labeltapen command. The tape_label is the name specified by the backup labeltape command's -name or -pname
	       argument.

	   Scantape
	       Initiated by the backup scantape command.

	   SaveDb
	       Initiated by the backup savedb command.

	   RestoreDb
	       Initiated by the backup restoredb command.

       <status>
	   Indicates the job's current status in one of the following messages. If no message appears, the job is either still pending or has
	   finished.

	   number Kbytes, volume volume_name
	       For a running dump operation, indicates the number of kilobytes copied to tape or a backup data file so far, and the volume
	       currently being dumped.

	   number Kbytes, restore.volume
	       For a running restore operation, indicates the number of kilobytes copied into AFS from a tape or a backup data file so far.

	   [abort requested]
	       The backup kill command was issued, but the termination signal has yet to reach the Tape Coordinator.

	   [abort sent]
	       The operation is canceled by the backup kill command.  Once the Backup System removes an operation from the queue or stops it from
	       running, it no longer appears at all in the output from the command.

	   [butc contact lost]
	       The backup command interpreter cannot reach the Tape Coordinator. The message can mean either that the Tape Coordinator handling
	       the operation was terminated or failed while the operation was running, or that the connection to the Tape Coordinator timed out.

	   [done]
	       The Tape Coordinator has finished the operation.

	   [drive wait]
	       The operation is waiting for the specified tape drive to become free.

	   [operator wait]
	       The Tape Coordinator is waiting for the backup operator to insert a tape in the drive.

EXAMPLES
       The following example shows that two restore operations and one dump operation are running (presumably on different Tape Coordinators) and
       that the backup command interpreter's tokens expire on 22 April 1999 at 10:45 am:

	  backup> jobs
	  Job 1: Restore, 1306 Kbytes, restore.volume
	  Job 2: Dump (user.sunday1), 34 Kbytes, volume user.pat.backup
	  Job 3: Restore, 2498 Kbytes, restore.volume
		 04/22/1999 10:45: TOKEN EXPIRATION

PRIVILEGE REQUIRED
       None. However, queuing any operation requires privilege, and it is possible to issue this command only within the interactive session in
       which the jobs are queued.

SEE ALSO
       backup(8), backup_interactive(8), backup_kill(8), backup_quit(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_JOBS(8)
All times are GMT -4. The time now is 05:13 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy