Cron

From UGCS
Jump to: navigation, search

Getting cron services available to users is a work in progress. Presently, cron is being architected with two sides:

  • Users update their crontabs using a modified crontab program in their path which notifies a central server on updates. The central server (currently hephaestus for testing) parses their file and stores well-formatted commands into our database (currently MySQL).
  • The central cron server runs its own (real) cron command every minute to check the database for commands to run. It then uses a keytab to load username_cron principals (currently only ckennelly_cron exists), logs into a shellserver, and runs the command.

Parsing

The modified crontab program lives at ~ckennelly/cron/crontab. It stores the user's crontab at ~/.cron/crontab. When the directory is created, crontab gives the _cron principal read permission on the directory's ACL.

It fires a notification to hephaestus via remctl to parse the crontab. It loads up its keytab using a bash-based wrapper (/usr/local/lib/remctl/cron/cronparser_wrapper) and then fires the python-based parser (/usr/local/lib/remctl/cron/cronparser).

The parser has some features, but is still lacking in others:

  • More testing!
  • Comma-separated lists (ranges work, along with non-default increments)
  • Comma-separated lists with ranges
  • Shortcuts (like @hourly)
  • Three-letter names for months and days of week
  • Standard environment variables (like the real crontab specification), SHELL and MAILTO. Additionally, I haven't checked support for HOME at runtime.
  • Support UGCS-specific environment variables in the crontab. Alex suggested having RUNAT so a user could specify a specific shellserver to run the command at.

Execution

A development version is configured on hephaestus (see: /usr/local/lib/cron/cronmanager) to run every minute via cron. Based on results from my own crontab setup, it seems to be working.

The manager still needs:

  • More testing!
  • A threaded producer-consumer style queue to avoid forking too many processes.
  • Error handling (errors are currently dropped on the floor)

Installation

Hephaestus required:

  • sqlobject for python
  • mysqldb for python (python-mysqldb)

My (ckennelly) user account required:

  • ~/.k5login to be created with my full principal as well as my cron principal.
Personal tools