Package pulp :: Package server :: Module crontab
[hide private]
[frames] | no frames]

Module crontab

source code


Example Use:

from crontab import CronTab

tab = CronTab()
cron = tab.new(command='/usr/bin/echo')

cron.minute().during(5,50).every(5)
cron.hour().every(4)

cron2 = tab.new(command='/foo/bar',comment='SomeID')
cron2.every_reboot()

list = tab.find_command('bar')
cron3 = list[0]
cron3.clear()
cron3.minute().every(1)

print unicode(tab.render())

for cron4 in tab.find_command('echo'):
    print cron4

for cron5 in tab:
    print cron5

tab.remove_all('echo')

t.write()


Version: 0.9.3

Classes [hide private]
  CronTab
Crontab object which can access any time based cron using the standard.
  CronItem
An item which objectifies a single line of a crontab and May be considered to be a cron job object.
  CronSlice
Cron slice object which shows a time pattern
  CronRange
A range between one value and another for a time range.
  CronCommand
Reprisent a cron command as an object.
Variables [hide private]
  CRONCMD = "/usr/bin/crontab"
  ITEMREX = re.compile('^\s*([^@#\s]+)\s+([^@#\s]+)\s+([^@#\s]+)...
  SPECREX = re.compile('@(\w+)\s([^#\n]*)(\s+#\s*([^\n]*)|$)')
  DEVNULL = ">/dev/null 2>&1"
  MONTH_ENUM = ['jan', 'feb', 'mar', 'apr', 'may', 'jun', 'jul',...
  WEEK_ENUM = ['sun', 'mon', 'tue', 'wed', 'thu', 'fri', 'sat', ...
  SPECIALS = {"reboot": '@reboot', "hourly": '0 * * * *', "daily...
  S_INFO = [{'name': 'Minutes', 'max_v': 59, 'min_v': 0}, {'name...
Variables Details [hide private]

ITEMREX

Value:
re.compile('^\s*([^@#\s]+)\s+([^@#\s]+)\s+([^@#\s]+)'+ '\s+([^@#\s]+)\\
s+([^@#\s]+)\s+([^#\n]*)(\s+#\s*([^\n]*)|$)')

MONTH_ENUM

Value:
['jan', 'feb', 'mar', 'apr', 'may', 'jun', 'jul', 'aug', 'sep', 'oct',\
 'nov', 'dec',]

WEEK_ENUM

Value:
['sun', 'mon', 'tue', 'wed', 'thu', 'fri', 'sat', 'sun',]

SPECIALS

Value:
{"reboot": '@reboot', "hourly": '0 * * * *', "daily": '0 0 * * *', "we\
ekly": '0 0 * * 0', "monthly": '0 0 1 * *', "yearly": '0 0 1 1 *', "an\
nually": '0 0 1 1 *', "midnight": '0 0 * * *'}

S_INFO

Value:
[{'name': 'Minutes', 'max_v': 59, 'min_v': 0}, {'name': 'Hours', 'max_\
v': 23, 'min_v': 0}, {'name': 'Day of Month', 'max_v': 31, 'min_v': 1}\
, {'name': 'Month', 'max_v': 12, 'min_v': 1, 'enum': MONTH_ENUM}, {'na\
me': 'Day of Week', 'max_v': 7, 'min_v': 0, 'enum': WEEK_ENUM},]