## p4get-journallist ## aaron bockelie function p4get-journallist {param($clusterName,[switch]$purge,[switch]$noConfirm) if (!$env:depotsxml) { write-error "Could not locate depots.xml configuration file." break } $servercheck = p4get-server if ($servercheck.pingsuccess.equals($true)) { $static = ([xml](gc $env:depotsxml)) #pull the entire depots config $replTopology = p4get-replicationTopology #get the topology of the signed in server. $journalMaster = $static.perforce.depot | ?{$_.name -eq $replTopology.parent.hostname} #find the journal master (the master server) $checkpointHost = $static.perforce.depot | ?{$_.name -eq ($repltopology.parent.children | ?{$_.checkpointTarget -eq "true"} | %{$_.hostname})} #find the checkpoint host config $journalPath = ("\\" + $journalMaster.name + "\" + $journalMaster.svcRootDrive + "$\" + $journalMaster.svcRootPath + "\") #locate the journal path on the master config $historicJournals = gci $journalPath | ?{$_.name -match "journal"} | ?{$_.extension} #list all jorunal files that are probably not in use (numbered journal files). files that are named just "journal" are CERTAINLY in use. $HighestJournal = [int](p4get-replicationstate).masterJournalNumber -2 #get the highest journal number that is safe. One removed from highest $deleteList = $HistoricJournals | ?{[int]$_.Extension.Substring(1) -lt $HighestJournal} if ($purge) { if (!$noConfirm) { write-warning ("Remove " + $deletelist.count + " journal files?") -warningaction Inquire foreach ($file in $deletelist) { remove-item $file.fullname -force $file.fullname } } else { foreach ($file in $deletelist) { write-verbose "Not removing active or two adjacent to active journal file." remove-item $file.fullname -force $file.fullname } } } else { write-verbose ("Highest journal file removed would be " + ([int](p4get-replicationstate).masterJournalNumber -2)) foreach ($file in $deletelist) { $file.fullname } } } }
# | Change | User | Description | Committed | |
---|---|---|---|---|---|
#1 | 8410 | Aaron Bockelie |
Root checkin, Perforce Powershell wrapper. Still lots of work to be done, namely documentation and deployment tools, for instance, get-help needs work on the majority of these tools. Additionally, the /lib structure needs a little bit of condensation, probably into major groups (depot, userspec, clientspec, group management, and so on) that way function family can exist under each resource. |