Class: Yast::CronClass

Inherits:
Module
  • Object
show all
Defined in:
library/cron/src/modules/Cron.rb

Instance Method Summary collapse

Instance Method Details

#AddSimple(comment, envs, command, event, file) ⇒ Boolean

Add a simple cron job with comment and env. variables

Parameters:

  • comment (String)
  • map

    with environment variables

  • command (String)
  • event (Hash)

    event time: dom, dow, hour, minute, month, special

  • file (String)

    path to write cron to

Returns:

  • (Boolean)

    true on success



66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
# File 'library/cron/src/modules/Cron.rb', line 66

def AddSimple(comment, envs, command, event, file)
  envs = deep_copy(envs)
  event = deep_copy(event)
  cron = {}
  # Comments first
  comments = []
  comments = Builtins.add(comments, comment)
  Ops.set(cron, "comments", comments)

  # Variables
  Ops.set(cron, "envs", envs)

  # Events
  events = []
  Ops.set(event, "command", command)

  events = Builtins.add(events, event)

  Ops.set(cron, "events", events)

  crons = []
  crons = Builtins.add(crons, cron)

  ret = Write(file, crons)
  ret
end

#mainObject



35
36
37
# File 'library/cron/src/modules/Cron.rb', line 35

def main
  textdomain "base"
end

#Read(filename, options) ⇒ Array

Read crontab contents

Parameters:

  • filename (String)
  • options (Hash)

    (not implemented yet)

Returns:

  • (Array)

    crontab contents



43
44
45
46
47
# File 'library/cron/src/modules/Cron.rb', line 43

def Read(filename, options)
  options = deep_copy(options)
  crontab = Convert.to_list(SCR.Read(path(".cron"), filename, options))
  deep_copy(crontab)
end

#Write(filename, blocks) ⇒ Boolean

Write crontab contents

Parameters:

  • filename (String)
  • blocks (Array)

Returns:

  • (Boolean)

    true on success



53
54
55
56
57
# File 'library/cron/src/modules/Cron.rb', line 53

def Write(filename, blocks)
  blocks = deep_copy(blocks)
  ret = SCR.Write(path(".cron"), filename, blocks)
  ret
end