MCPcopy Create free account
hub / github.com/celer-pkg/celer / assignAppendOnlyAttribute

Method assignAppendOnlyAttribute

pkgcache/cache_setup.go:307–315  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

305}
306
307func (n *NFSServerSetup) assignAppendOnlyAttribute() error {
308 args := []string{n.nfsDir, "-type", "d", "-exec", "chattr", "+a", "{}", ";"}
309 if output, err := cmd.NewExecutor("", "find", args...).ExecuteOutput(); err != nil {
310 return fmt.Errorf("failed to chattr +a to %s -> %s -> %w", n.nfsDir, output, err)
311 }
312
313 color.PrintHint("✔ apply append-only attribute (chattr +a) to %s", n.nfsDir)
314 return nil
315}
316
317// installChattrCronJob installs a cron job that runs "find <nfs-dir> -type d -exec chattr +a"
318// every minute, ensuring directories created by NFS clients are protected.

Callers 1

SetupMethod · 0.95

Calls 3

NewExecutorFunction · 0.92
PrintHintFunction · 0.92
ExecuteOutputMethod · 0.80

Tested by

no test coverage detected