SUMMARY (2): Notifying cron of changes to crontab files

From: Jeff Putsch (
Date: Fri Mar 12 1999 - 11:07:15 CST


With some help from Tim Pointing <>, I cobbled up
the following code snippet to test notification of the cron daemon on Solaris.
Seems to work, but as you can see I've only tested the cron queue and add
action combination.

The code is clearly NOT ready for production and really only allowed me to
test this approach.


--- C code snippet to notify cron of changes in a crontab ---

  #include <string.h>
  #include <sys/types.h>
  #include <sys/stat.h>
  #include <unistd.h>
  struct cron_update {
        char cron_queue;
        char cron_action;
        char cron_username[15];
        char cron_filename[9];

  #define CRON_AT_QUEUE 'a'
  #define CRON_BATCH_QUEUE 'b' /* ??? */
  #define CRON_CRON_QUEUE 'c'

  #define CRON_ADD_ACTION 'a'
  #define CRON_REMOVE_ACTION 'r'

  main(int argc, char *argv[]) {
    char *username;
    struct cron_update upd;
    char *tmp;
    int fifo;


    upd.cron_queue = CRON_CRON_QUEUE;
    upd.cron_action = CRON_ADD_ACTION;

    fifo = open("/etc/cron.d/FIFO", O_WRONLY|O_NDELAY);


Jeff Putsch | Internet:
Unitrode |
7 Continental Blvd. | Fax : (US) 603-429-8564
Merrimack, NH 03054 USA | Voice : (US) 603-429-8626 (daytime)

This archive was generated by hypermail 2.1.2 : Fri Sep 28 2001 - 23:13:16 CDT