Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 22 Nov 1999 10:03:04 -0600 (CST)
From:      Mark Tinguely <tinguely@plains.NoDak.edu>
To:        freebsd-questions@FreeBSD.ORG, jquincy@mail.burlco.lib.nj.us
Subject:   Re: backup w/o touching files' last-accessed times
Message-ID:  <199911221603.KAA27881@plains.NoDak.edu>

next in thread | raw e-mail | index | archive | help
>
>  I'm using "dump" to backup users' e-mail nightly.  Unfortunately this
>  changes the last-accessed time of their INBOX so that their shell only
>  reports "You have mail" instead of "You have new mail" when they log in. 
>  (Say they receive new mail at 2:55a and the backup is done at 3:00a.  The
>  last-accessed time is greater than the last-modified time, so the shell
>  assumes the user has already read his latest mail.) 

something else, like a find, is modifying your file attribute times.
dump uses the raw device to create the backup and does not modify the
access, modify, nor change attributes of either directory or files.
backup programs (like cpio, and tar) that use the filesytem will modify
you access times, but not dump.

you can use "ls -lu"  or a simple "stat" program below to verify, by:

# stat /var/mail/* [| less]	# or ls -lu
# dump 0sf 99999 /dev/null /[var]
# stat /var/mail/* [| less]	# or ls -lu

stat.c:
/* display the access, modify and change attributes for a file
 */
#include <sys/types.h>
#include <sys/stat.h>

main(argc, argv)
int argc;
char **argv;
{
   int i;
   struct stat buf;

   if (argc < 2) {
      puts("Usage: stat file(s)");
      exit(1);
   }
   for (i = 1; i < argc; i++) {
      if (stat(argv[i], &buf) < 0)
         printf("Bad file: %s\n", argv[i]);
      else {
         printf("%s:\n", argv[i]);
         printf("  size:    %d\n",buf.st_size);
         printf("  access time:  %s",ctime(&buf.st_atime));
         printf("  modify time:  %s",ctime(&buf.st_mtime));
         printf("  change time:  %s",ctime(&buf.st_ctime));
      }
   }
}


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199911221603.KAA27881>