MCPcopy Create free account
hub / github.com/cronitorio/cronitor-cli / IsWritable

Method IsWritable

lib/crontab.go:319–330  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

317}
318
319func (c Crontab) IsWritable() bool {
320 if c.IsUserCrontab {
321 return true
322 }
323
324 file, err := os.OpenFile(c.Filename, os.O_WRONLY, 0666)
325 defer file.Close()
326 if err != nil {
327 return false
328 }
329 return true
330}
331
332func (c Crontab) IsRoot() bool {
333 return !c.IsUserCrontab || c.User == "root"

Callers 2

processDirectoryFunction · 0.80
processCrontabFunction · 0.80

Calls 1

CloseMethod · 0.80

Tested by

no test coverage detected