iCalendar as a crontab alternative

Tagged:

iCalendar files could be used for job scheduling, the same way crontab is. Instead of the five time and date fields you could specify an iCalendar file. Each event in the iCalendar file will trigger the execution of the corresponding command. Event attributes (like summary, location, description, duration, etc) could be passed as arguments to the command.

For example, let's say you have a radio tuner card and you want to automatically record shows on different stations. You can use any iCalendar compliant calendar editor (iCal, Evolution, Sunbird) and in a special calendar called radio (saved to /home/me/radio.ics) you enter all the shows you want to record. You will use the location field to enter the station frequency (or call sign). The crontab equivalent configuration file would look something like:

/home/me/radio.ics  radiorecorder -f $EVENT_LOCATION -d $EVENT_DURATION -t $EVENT_SUMMARY

Whenever radiorecorder is executed it will tune the radio card to the frequency given by the -f argument, will start recording for the duration of the -d argument and will name (and tag) the file using the -t argument and current date.

Pros:

  • you can use a nice gui editor to schedule jobs
  • job runs can be parameterized using the corresponding event attributes
  • calendars could be edited online (like google calendar) and synchronized locally, this would allow you to remote control your jobs

Cons:

  • recurring events have a granularity of at least one day (you cannot schedule something to run every hour for example)
  • a system like this needs to be written

Advanced features:

  • multiple ways to specify an iCalendar file, local file system, http, webdav, caldav, google calendar api
  • support both vevent and vtodo objects
  • capture the command output and email it to the event attendees
  • capture the command output and add it to the corresponding event (as a comment, attachment, append to description or add as separate vjournal object)
  • todo status could be changed to:
    • In Process - when command started
    • Completed On - command ends without errors
    • Cancelled - command ends with errors
    • Needs Action or Cancelled - future command with scheduling conflicts
Technorati Tags:
Syndicate content