* GC option `--max-atime' that specifies an upper limit to the last
accessed time of paths that may be deleted. Anything more recently used won't be deleted. The time is specified in time_t, e.g. seconds since 1970-01-01 00:00:00 UTC; use `date +%s' to convert to time_t from the command line. Example: to delete everything that hasn't been used in the last two months: $ nix-store --gc -v --max-atime $(date +%s -d "2 months ago")
This commit is contained in:
		
							parent
							
								
									4af2fdba6d
								
							
						
					
					
						commit
						f32fef1b07
					
				
					 4 changed files with 24 additions and 7 deletions
				
			
		|  | @ -531,8 +531,14 @@ static void opGC(Strings opFlags, Strings opArgs) | |||
|         else if (*i == "--max-freed") options.maxFreed = getIntArg(*i, i, opFlags.end()); | ||||
|         else if (*i == "--max-links") options.maxLinks = getIntArg(*i, i, opFlags.end()); | ||||
|         else if (*i == "--use-atime") options.useAtime = true; | ||||
|         else if (*i == "--max-atime") { | ||||
|             options.useAtime = true; | ||||
|             options.maxAtime = getIntArg(*i, i, opFlags.end()); | ||||
|         } | ||||
|         else throw UsageError(format("bad sub-operation `%1%' in GC") % *i); | ||||
| 
 | ||||
|     if (!opArgs.empty()) throw UsageError("no arguments expected"); | ||||
|      | ||||
|     PrintFreed freed(options.action == GCOptions::gcDeleteDead, results); | ||||
|     store->collectGarbage(options, results); | ||||
| 
 | ||||
|  | @ -745,7 +751,7 @@ void run(Strings args) | |||
|             indirectRoot = true; | ||||
|         else if (arg[0] == '-') {             | ||||
|             opFlags.push_back(arg); | ||||
|             if (arg == "--max-freed" || arg == "--max-links") { /* !!! hack */ | ||||
|             if (arg == "--max-freed" || arg == "--max-links" || arg == "--max-atime") { /* !!! hack */ | ||||
|                 if (i != args.end()) opFlags.push_back(*i++); | ||||
|             } | ||||
|         } | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue