Jump to content


Finding all open files on a server to create a rsync list ...

backup opened

  • Please log in to reply
3 replies to this topic

#1 Doc Kaos

Doc Kaos

    Member

  • Members
  • PipPip
  • 12 posts

Posted 26 September 2013 - 08:56 PM

To create an list of files that NEED to be backed up, I'd like to find all opened files on a host and create a list for rsync.

In this way I don't have to worry about backing up build artifacts and non-essential files, just files added or edited in Perforce that have not been submitted.

Our file system is slow to traverse or else we could search for writable files and back those up, but getting a list of Opened files in Perforce seems extremely quick.

The trick is to know how they are mapped to the file system and what clients are used on what hosts.

Any tips at all or pointer in the right direction would be great.

Thanks

#2 P4Matt

P4Matt

    Advanced Member

  • Members
  • PipPipPip
  • 1383 posts

Posted 27 September 2013 - 03:56 AM

Do you know the name of the host you want to backup going into the process? Or are you backing up files from multiple hosts?

#3 Doc Kaos

Doc Kaos

    Member

  • Members
  • PipPip
  • 12 posts

Posted 27 September 2013 - 01:33 PM

I do have the host name ... the unfortunate part is since multiple hosts share the same /home directory, users remove the Host: line from their client specs so they can log on to whichever host they like.

#4 P4Matt

P4Matt

    Advanced Member

  • Members
  • PipPipPip
  • 1383 posts

Posted 27 September 2013 - 06:50 PM

That does make it a bit rougher. I can't think of any magic to make this easy, but I think if I were to build a system like this I would do the following:

* Run 'p4 -tag opened -a' to get all of the open files and their related workspaces.
* Troll through the list of  opened files and throw out any that have a client that bound to another host
* For each of the remaining files take the 'clientFile' value that was returned by the earlier 'p4 opened -a' command and replace the client name with the client root from that file.

At this point you should have all of the files that are potentially on that host in local syntax. You should just be able to blindly back them all up, skipping any that aren't actually there. Does that seem reasonable?





Also tagged with one or more of these keywords: backup, opened

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users