2024-01-06  Sergey Poznyakoff  <gray@gnu.org>

        Version 1.4


2024-01-03  Sergey Poznyakoff  <gray@gnu.org>

        Update documentation


2024-01-03  Sergey Poznyakoff  <gray@gnu.org>

        Bugfix

        * src/crontab.c: Fix handling of EXDEV.

2024-01-03  Sergey Poznyakoff  <gray@gnu.org>

        Update copyright years


2023-12-18  Sergey Poznyakoff  <gray@gnu.org>

        Version 1.3.93


2023-12-18  Sergey Poznyakoff  <gray@gnu.org>

        Bugfixes

        * src/micron.c (micron_parse_range): Accept \t after dow range
        (complements a6a82ea703).
        (micron_parse_timespec): Always set endp before return.
        * tests/parsetest.c (main): Initialize micronexp.dsem.

2023-06-02  Sergey Poznyakoff  <gray@gnu.org>

        Use newer autotools

        * am/ax_pthread.m4: Update to version 31.
        * configure.ac: Don't use obsolete macros.

2023-03-23  Sergey Poznyakoff  <gray@gnu.org>

        crontab: avoid data loss on error

        * src/crontab.c (crontab_open): Check of ownership needs to be
        fixed prior to attempting to fix it.  Don't bail out if unable
        to do so.
        (command_install): Don't try to fix ownership here: it is done
        by crontab_open.
        * src/tempfile.c (create_temp_file): Use openat.

2023-03-23  Sergey Poznyakoff  <gray@gnu.org>

        Version 1.3.92


2023-03-09  Sergey Poznyakoff  <gray@gnu.org>

        Various fixes in the docs


2023-03-08  Sergey Poznyakoff  <gray@gnu.org>

        Fix race condition

        * src/runner.c (cron_thr_runner): Run the queue before calling
        pthread_cond_wait: upon startup the queue may already contain
        some entries (e.g. @reboot ones) inserted by cron_thr_main while
        the cron_thr_runner thread was being created.

2023-01-10  Sergey Poznyakoff  <gray@gnu.org>

        Version 1.3.91


2023-01-10  Sergey Poznyakoff  <gray@gnu.org>

        Update copyright years.  Minor fixes in manpages.


2023-01-10  Sergey Poznyakoff  <gray@gnu.org>

        Bugfix

        * src/micron.c (micron_parse_range): Allow for horizontal tab
        after symbolic name.

2022-03-28  Sergey Poznyakoff  <gray@gnu.org>

        Fix time zone handling

        * src/micron.c (micron_next_time_from): Take into account time
        zone difference.
        * src/micrond.c (cronjob_arm): Check return value from
        micron_next_time or micron_next_time_from.
        * NEWS: Document changes.

2022-03-27  Sergey Poznyakoff  <gray@gnu.org>

        Fix the vscope.at test


2022-01-02  Sergey Poznyakoff  <gray@gnu.org>

        Update copyright year


2022-01-02  Sergey Poznyakoff  <gray@gnu.org>

        Update copyright year


2021-12-16  Sergey Poznyakoff  <gray@gnu.org>

        Change official package name to GNU micron


2021-12-13  Sergey Poznyakoff  <gray@gnu.org>

        Minor changes

        * Makefile.am: Add rule for generating ChangeLog
        * doc/Makefile.am: Remove duplicate lines.
        * tests/micronh.c: Fix documentation.

2021-12-13  Sergey Poznyakoff  <gray@gnu.org>

        Follow-up to 64a977b05f

        * tests/maxinst.at: Fix sed expressions

2021-12-13  Sergey Poznyakoff  <gray@gnu.org>

        Add missing copyright statements


2021-10-30  Sergey Poznyakoff  <gray@gnu.org>

        Spell checking


2021-10-29  Sergey Poznyakoff  <gray@gnu.org>

        Version 1.3


2021-10-28  Sergey Poznyakoff  <gray@gnu.org>

        Update manpages.  Rename -v option in crontab to match that in
        micrond.


2021-10-28  Sergey Poznyakoff  <gray@gnu.org>

        Rename the -o option to -v.  Use -V to print program version.


2021-10-28  Sergey Poznyakoff  <gray@gnu.org>

        New option -Wparanoid_memfree

        * src/micrond.c (paranoid_memfree): New variable.
        (main): In paranoid_memfree mode, free all memory prior to
        exiting.
        (pwdbuf_free): Do nothing if f is NULL.
        * src/micrond.h (CGF_PATALLOC): New define.
        * doc/micron.texi: Document -W
        * src/micrond.supp: Likewise.

2021-10-28  Sergey Poznyakoff  <gray@gnu.org>

        Bugfix

        * src/micrond.c (cronjob_options_dup)
        (cronjob_options_free): New functions.
        (crontab_parse): Allocate crontab-wise cronjob_options prior to 
        entering the loop and free it afterwards to avoid modifying the 
        global micron_options.
        * tests/vscope.at: New test case.
        * README: Update test timing information.
        * doc/micron.texi: Update documentation.

2021-10-27  Sergey Poznyakoff  <gray@gnu.org>

        Fix copyright statements


2021-10-27  Sergey Poznyakoff  <gray@gnu.org>

        Fixes in testsuite

        * README: Document the version of libfaketime needed.
        * tests/Makefile.am: Link ftt with pthreads.
        * tests/ftt.c: Rewrite to test for working
        pthread_cond_timedwait.
        * tests/outfile.at: Compensate for start time ambiguity

2021-10-26  Sergey Poznyakoff  <gray@gnu.org>

        Minor fix in testsuite

        * tests/ftt.c: Use GMT times

2021-10-26  Sergey Poznyakoff  <gray@gnu.org>

        Minor fixes

        * src/micrond.c (main): Don't unblock signals prior to waiting.
        * tests/micronh.c: Check handling of sigtimedwait return.

2021-10-26  Sergey Poznyakoff  <gray@gnu.org>

        Improve testsuite

        * README: Document micrond checks.
        * tests/ftt.c: New auxiliary program.
        * tests/atlocal.in: Test if libfaketime is working.
        * tests/linecont.at: New testcase.
        * tests/.gitignore: Update.
        * tests/Makefile.am: Build ftt

2021-10-26  Sergey Poznyakoff  <gray@gnu.org>

        Test simultaneous instance limits.

        Rename rc.c to micronh.c (micron harness) Don't require
        libfakeroot if running as root.

2021-10-25  Sergey Poznyakoff  <gray@gnu.org>

        Write autotest-based testsuite

        * configure.ac: Don't use obsolete constructs. Configure tests/
        directory. New options: --with-fakeroot and --with-faketime.
        * src/micrond.c: New option -T.
        (stderr_log): Optionally print timestamp.
        (main): Ignore CRONTAB_UNSAFE if no_safety_checking (-N) is in 
        effect.
        (crongroup_init): Return CRONTAB_UNSAFE where appropriate.

        * tests/Makefile.am: Rewrite for autotest-based testsuite
        * tests/.gitignore: New file.
        * tests/atlocal.in: Likewise.
        * tests/day.at: Likewise.
        * tests/dom.at: Likewise.
        * tests/dow.at: Likewise.
        * tests/hr.at: Likewise.
        * tests/mail.at: Likewise.
        * tests/min.at: Likewise.
        * tests/next.at: Likewise.
        * tests/parser.at: Likewise.
        * tests/vinput.at: Likewise.
        * tests/syslog.at: Likewise.
        * tests/outfile.at: Likewise.

        * tests/mockmail.c: New auxiliary program.
        * tests/testsuite.at: Likewise.
        * tests/rc.c: Likewise.
        * tests/timetest.c (main): Properly initialize ent.dsem before
        calls to micron_parse.

        Bugfixes

        * src/runner.c (cron_thr_cleaner): Restore the check for
        non-zero size, accidentally removed in the previous commit.
        * src/micron_log.c (log_open): Call open_logger here, instead of 
        in thr_syslog.  This fixes a race condition between
        log_message_create and open_logger when micrond is running in
        foreground.

2021-10-24  Sergey Poznyakoff  <gray@gnu.org>

        Minor changes


2021-10-23  Sergey Poznyakoff  <gray@gnu.org>

        Update (and reformat) README and NEWS


2021-10-23  Sergey Poznyakoff  <gray@gnu.org>

        Optionally append cronjob output to a file.

        * NEWS: Document changes.
        * doc/micron.texi: Likewise.

        * src/micrond.h (cronjob_output_type): New data type.
        (cronjob_options) <output_type, outfile>: New members.
        (cronjob) <output_type>: New member.
        <syslog_facility, mailto>: Remove.
        <output>: New member.
        (BUILTIN_OUTFILE): New define.
        (outfile_find, outfile_release, outfiles_close): New functions.
        * src/micrond.c (micron_options): Set output_type.
        (main): Handle SIGHUP separately.
        (cronjob_unref): Release outfile if necessary.
        (cronjob_alloc): Change handling of output options.
        (cronjob_options_ref, cronjob_options_unref): Handle the outfile
        field.
        (vardef): Handle the *_OUTFILE variables.
        * src/runner.c (proctab): Remove syslog, add start.
        (runner_start): Save start time in proctab.start
        (cron_thr_cleaner): Send output via email or append it to a
        file, as requested.
        (outfile_open, outfile_find, outfile_release)
        (outfiles_close): New functions.
        (cronjob_output_enqueue, cronjob_output_dequeue): New functions.
        (cron_thr_output): Output handling thread.
        * src/micrond.supp: Update.

2021-10-20  Sergey Poznyakoff  <gray@gnu.org>

        Minor change in crontab.5


2021-05-06  Sergey Poznyakoff  <gray@gnu.org>

        Implement the -P option (pidfile)


2021-04-15  Sergey Poznyakoff  <gray@gnu.org>

        Version 1.2


2021-04-02  Sergey Poznyakoff  <gray@gnu.org>

        Free structures allocated for deleted cronjobs

        * src/micrond.c (crontab_deleted): Call crontab_forget.
        * src/micrond.h (cronjob) <fileid>: Change type to unsigned.

2021-04-01  Sergey Poznyakoff  <gray@gnu.org>

        Serialize access to struct cronjobs

        * src/micrond.c (crongroup_parse)
        (crongroup_forget_crontabs): Mark as static.
        (cronjob_ref_mutex): New mutex.
        (cronjob_ref): Protect access using cronjob_ref_mutex.
        (cronjob_unref): Likewise.  When reference counter is 
        decremented, just free the object without unlinking it from any
        lists, as it must have been unlinked by the caller.
        * src/micrond.h (cronjob_ref,cronjob_unref): Replace inline
        functions with prototypes.

2021-03-26  Sergey Poznyakoff  <gray@gnu.org>

        Description of the proposed changes to introduce inter-job
        dependencies


2021-02-15  Sergey Poznyakoff  <gray@gnu.org>

        Fix unsetting variables in crontabs

        * NEWS: Version 1.1
        * configure.ac: Version 1.1
        * src/micrond.c (crontab_parse): Set rc to 0 when unsetting the 
        variable.
        * src/runner.c: Fix diagnostic messages.

2021-02-03  Sergey Poznyakoff  <gray@gnu.org>

        Version 1.0


2021-01-26  Sergey Poznyakoff  <gray@gnu.org>

        Update documentation

        * NEWS: Update.
        * doc/micron.texi: Update.
        * doc/fdl.texi: Version 1.3

2021-01-25  Sergey Poznyakoff  <gray@gnu.org>

        Support for Vixie-style job input specification in crontab
        lines.

        * src/micrond.h (cronjob): New field: input.
        * src/micron_log.c (log_open): Lock the mutex while initializing 
        micron_log_tag, micron_log_facility, and starting the syslog
        thread.
        (micron_log_close): Likewise.
        (thr_syslog): Free micron_log_tag before terminating.
        * src/micrond.c (main): Call micron_log_close before exiting. 
        This should drain the log queue and release the allocated
        memory.
        (find_percent): New function.
        (cronjob_alloc): Split command and eventual Vixie-style input 
        specification.  Save the latter in job->input (with all
        unescaped
        %'s converted to newlines).
        (crongroup_init): Add missing return.
        * src/micrond.supp: Suppress warning about not terminated logger 
        thread.
        * src/runner.c (pipe_input_thread): New thread to pipe the input
        to job's standard input.
        (runner_start): Handle Vixie-style input specification.

        * NEWS: Document new features.
        * doc/crontab.5: Likewise.
        * doc/micron.texi: Likewise.

2021-01-25  Sergey Poznyakoff  <gray@gnu.org>

        New function for closing all file descriptors starting from N

        Imported from mailutils.

        * configure.ac: Select a suitable interface for closing all file 
        descriptors greater than or equal to a chosen one.
        * src/Makefile.am (libmicron_a_SOURCES): Add closefds.c
        * src/closefds.c: New file.
        * src/crontab.c (command_edit): Use close_fds.
        * src/defs.h (close_fds): New proto.

2021-01-25  Sergey Poznyakoff  <gray@gnu.org>

        Bugfixes

        * src/patmatch.c (patmatch): Fix NULL dereference.
        * src/runner.c: Fix race condition between creation of
        logger_pipe and first write to it.
        (logger_pipe): Initialize.
        (cron_thr_logger): Don't create logger_pipe here.
        (logger_enqueue): Create control pipe here instead.

2021-01-24  Sergey Poznyakoff  <gray@gnu.org>

        Add src/micrond.supp


2021-01-24  Sergey Poznyakoff  <gray@gnu.org>

        Remove left-over debug print


2021-01-24  Sergey Poznyakoff  <gray@gnu.org>

        Restore signal handlers in child processes.  Terminate all
        threads before exiting.

        * src/micrond.c (micron_termination_timeout): New global.
        (restore_default_signals): New function.
        (main): Handle the -t option. If running in foreground redirect
        /dev/null to stdin. Rewrite thread startup sequence.  Terminate
        all threads before exiting.
        * src/micrond.h (micron_termination_timeout): New extern.
        (stop_thr_cleaner, default_stop_thread)
        (restore_default_signals): New protos.
        * src/runner.c (proctab_rm_cond): New condition variable.
        (proctab_remove_safe): Brodcast to proctab_rm_cond.
        (runner_start): Fix memory leaks (unfreed env). Restore default
        signals in the child process.
        (cron_cleanup_runner): New function.
        (cron_thr_runner): Set up the cleanup routine.
        (stop_thr_cleaner): New function.
        * src/watcher.c (cron_cleanup_watcher): New function.
        (cron_thr_watcher): Set up the cleanup routine. Fall back to the
        traditional scanner if watcher_setup fails.

        * doc/micron.texi: Document the -t option.
        * doc/micrond.8: Likewise.
        * NEWS: Describe changes.

2021-01-23  Sergey Poznyakoff  <gray@gnu.org>

        Fix memory leak in handling of struct cronjob_options.

        The mailto field wasn't accounted for in cronjob_options_unref. 
        To avoid the same error in case new string fields are added to
        the struct, the existing string fields are changed from simple
        char * to String - a special object that holds a string and the
        number of times it is referenced.

        * src/defs.h (String): New typedef.
        * src/micrond.h (cronjob_options): Change types of syslog_tag 
        and mailto to String.
        * src/micrond.c (string_value, string_reference_size)
        (string_ref, string_alloc, string_init)
        (string_copy, string_free): Implementation of the String type.
        (cronjob_alloc): Use string_value to obtain actual value of 
        String fields.
        (cronjob_options_ref): Increase reference counters of mailto and
        syslog_tag.
        (cronjob_options_unref): Use string_free to deallocate string 
        values when necessary.
        (set_syslog_tag,set_builtin_mailto)
        (set_env_mailto,crontab_parse): use new string functions.

2021-01-19  Sergey Poznyakoff  <gray@gnu.org>

        Update documentation


2021-01-18  Sergey Poznyakoff  <gray@gnu.org>

        Switch to docs in texinfo format.


2021-01-17  Sergey Poznyakoff  <gray@gnu.org>

        Version 0.9.90


2021-01-17  Sergey Poznyakoff  <gray@gnu.org>

        New micrond option: -S

        * doc/micrond.8: Document the -S option.  Remove leftover
        references to the withdrawn -F option.
        * src/micrond.c: Implement the -S option.

2021-01-12  Sergey Poznyakoff  <gray@gnu.org>

        Version 0.9


2021-01-12  Sergey Poznyakoff  <gray@gnu.org>

        Serialize access to the process list

        * src/runner.c (proctab_lookup_job_safe): New function.
        (runner_start): Use proctab_lookup_job_safe.

2021-01-06  Sergey Poznyakoff  <gray@gnu.org>

        Update copyright years


2020-12-17  Sergey Poznyakoff  <gray@gnu.org>

        Version 0.8


2020-06-25  Sergey Poznyakoff  <gray@gnu.org>

        Inherit umask from the shell.

        * src/micrond.c (saved_umask): New global.
        (main): Save current umask value in saved_umask.
        * src/runner.c (runner_start): Set umask from saved_umask.

2020-06-25  Sergey Poznyakoff  <gray@gnu.org>

        Fix umask for the cronjob.

        * src/runner.c (runner_start): Set umask 022 before exec'ing the 
        cronjob.

2020-06-24  Sergey Poznyakoff  <gray@gnu.org>

        Version 0.7 * NEWS: Document new version. * configure.ac: Raise
        version number.


2020-06-24  Sergey Poznyakoff  <gray@gnu.org>

        Allow for user group crontabs owned by root

        * src/micrond.c (crontab_stat): Skip group membership check for
        uid=0.

2020-06-23  Sergey Poznyakoff  <gray@gnu.org>

        crontab: fix crontab ownership

        * src/crontab.c (crongroup_id): Remove.
        (crontab_uid,crontab_gid): New statics.
        (main): Initialize crontab_uid and crontab_gid according to the 
        selected mode.
        (crontab_open): Fix ownership of the created file.
        (command_install,command_edit): Likewise.

2020-06-23  Sergey Poznyakoff  <gray@gnu.org>

        Process only filesystem events related to files that can
        possibly be crontabs

        * src/micrond.h (crongroup_skip_name): New proto.
        * src/micrond.c (crongroup_skip_name): New function.
        (crongroup_parse): Use crongroup_skip_name to sieve out
        uneligible files.
        * src/watcher.c (event_handler): Likewise.

2020-06-05  Sergey Poznyakoff  <gray@gnu.org>

        Update docs


2020-06-05  Sergey Poznyakoff  <gray@gnu.org>

        Version 0.6


2020-06-04  Sergey Poznyakoff  <gray@gnu.org>

        Bugfixes.

        * src/micrond.c (micron_environ_init): Initialize detached to 0.
        * src/crontab.c (command_edit): Create temporary directory in
        /tmp.
        * src/watcher.c: Improve diagnostic messages.

2020-05-21  Sergey Poznyakoff  <gray@gnu.org>

        Implement unsetting of environment variables

        * NEWS: Update.
        * configure.ac: Update.
        * doc/crontab.5: Document new features.
        * src/micrond.c (struct micron_environ): New member: detached.
        (micron_environ_create)
        (micron_environ_clone)
        (micron_environ_unset): New function.
        (micron_environ_build): Use micron_environ_clone.
        (cronjob_alloc): Save the mailto value.
        (vardef): Support unsetting the variables.
        (crontab_parse): The construct "name =" (with empty RHS) unsets
        the variable.
        * src/micrond.h (struct cronjob_options, cronjob): New member:
        mailto
        * src/runner.c (cron_thr_cleaner): The mailto setting is read 
        from: job->mailto member, "MAILTO" setting, and "LOGNAME"
        variable. First non-null result is used.

2020-05-20  Sergey Poznyakoff  <gray@gnu.org>

        crontab -g -l without filename shows list of crontabs in the
        group


2020-05-19  Sergey Poznyakoff  <gray@gnu.org>

        Version 0.5


2020-05-19  Sergey Poznyakoff  <gray@gnu.org>

        Bugfix

        * src/crontab.c (main): Set crontabname according to the -u 
        option

2020-05-18  Sergey Poznyakoff  <gray@gnu.org>

        Introduce the -o option


2020-05-18  Sergey Poznyakoff  <gray@gnu.org>

        Normalize the use of built-in variables

        * NEWS: Update.
        * README: Update.
        * configure.ac: Version 0.4.90
        * doc/README.org: Update.
        * doc/crontab.5: Update.
        * doc/micrond.8: Update.
        * src/micrond.c (cronjob_alloc): Take a pointer to
        cronjob_options as the first argument.
        (copy_unquoted): copy everything, including embedded whitespace.
        (cronjob_options_init,cronjob_options_ref)
        (cronjob_options_unref): New functions.
        (parse_env): Take cronjob_options as 2nd arg
        (crontab_parse): Parse built-in variables into struct
        cronjob_options. Use it when creating the struct cronjob.
        * src/micrond.h (struct cronjob_options): New struct.
        (cronjob_unref): syslog_tag is embedded in struct cronjob. Don't 
        free it.

2020-05-18  Sergey Poznyakoff  <gray@gnu.org>

        Bugfixes

        * src/crontab.c: Consult system user database for the actual 
        user name, instead of relying on LOGNAME.
        * src/micrond.c (cronjob_alloc): Use hints argument (unless
        NULL) to initialize the job.
        (crontab_find): Don't set ENV_SYSLOG_EVENTS.
        (crontab_parse): Parse built-in variables early and remove them 
        from the environment. Change the meaning of
        ENV_JOB_ALLOW_MULTIPLE to match the docs.
        * src/micrond.h (struct cronjob): New member runcnt.
        * src/runner.c (runner_start): Use allow_multiple as the upper
        limit of the instances running simultaneously.
        (cron_thr_logger): Fix overflow handling.

2020-05-16  Sergey Poznyakoff  <gray@gnu.org>

        Version 0.4

        * src/runner.c (cron_thr_logger)
        (logger_enqueue): Protect logger_queue by mutex.
        * AUTHORS: New file.
        * README: New file.
        * NEWS: Update.
        * configure.ac: Update.
        * doc/README.org: New file.
        * doc/org2ascii.el: New file.

2020-05-15  Sergey Poznyakoff  <gray@gnu.org>

        Change some wording in docs.


2020-05-15  Sergey Poznyakoff  <gray@gnu.org>

        Build a better syslog tag

        * src/micrond.c (crontab_parse): Build syslog tag from full
        crontab file name, line number and first word from the command.
        * src/micrond.h (struct cronjob): Remove line. Add
        syslog_facility and syslog_tag.
        (cronjob_unref): Free syslog_tag.
        * src/runner.c (runner_start): Use job->syslog_facility
        (struct logbuf): Remove facility and tag. Add job instead. All
        uses updated.

2020-05-15  Sergey Poznyakoff  <gray@gnu.org>

        Rewrite syslog redirection

        * runner.c: Use single logger thread.

2020-05-14  Sergey Poznyakoff  <gray@gnu.org>

        Bugfixes

        * src/micron_log.c: Include limits.h (for HOST_NAME_MAX).
        (log_message_create): Fix hostbuf size.
        * src/micrond.c (backup_file_table): Ignore all files starting
        with dot.
        (patmatch): Bugfix.
        (crongroup_parse): Fix severity level of the debugging message.
        * src/runner.c: Include limits.h
        (mailer_start): Minor change.

2020-05-14  Sergey Poznyakoff  <gray@gnu.org>

        Version 0.3


2020-05-14  Sergey Poznyakoff  <gray@gnu.org>

        Add manpages.

        * Makefile.am: New subdir: doc
        * configure.ac: Build doc/Makefile.
        * doc/Makefile.am: New file.
        * doc/crontab.1: New file.
        * doc/crontab.5: New file.
        * doc/micrond.8: New file.
        * src/crontab.c: Minor change.
        * src/micron_log.c (strfac): Add missing facilities.
        * src/micrond.c (micron_environ_build): Fix the precedence of
        the initial environment.
        (get_day_semantics): Use define instead of the hardcoded
        variable name.
        * src/micrond.h (ENV_CRON_DAY_SEMANTICS): New define.
        * src/runner.c (mailer_start): Run mailer on behalf of the job 
        owner.

2020-05-13  Sergey Poznyakoff  <gray@gnu.org>

        Add missing copylefts


2020-05-13  Sergey Poznyakoff  <gray@gnu.org>

        micrond: initialize crongroup directories at startup.


2020-05-13  Sergey Poznyakoff  <gray@gnu.org>

        Document the struct crongroup fields


2020-05-13  Sergey Poznyakoff  <gray@gnu.org>

        Implement the crontab utility


2020-05-12  Sergey Poznyakoff  <gray@gnu.org>

        Version 0.2.

        * NEWS: New file.

2020-05-12  Sergey Poznyakoff  <gray@gnu.org>

        Improve detection of various user crongroup modifications

        * src/micrond.c (crontab_stat): Check both file and owner
        primary groups.
        (crongroups_parse_all): Stop iterating when the original list
        end is hit.  This is to avoid rescanning the newly added user 
        crongroups.
        (usercrongroup_add_unlocked): New function.
        (usercrongroup_delete_unlocked): New function.
        (crongroup_parse): Rewind the directory after opening. Fix the
        fnmatch conditional. Use usercrongroup_add_unlocked to avoid
        deadlocks.
        (crongroup_forget_crontabs): Recursively handle the
        CGTYPE_GROUPHOST crongroup.
        * src/micrond.h (usercrongroup_add): Revert the signature.
        * src/watcher.c (event_handler): More than one crongroup can be 
        added as a result of CGTYPE_GROUPHOST rescan.  Set the
        corresponding watchers before leaving the function.

2020-05-12  Sergey Poznyakoff  <gray@gnu.org>

        Minor changes

        * src/micrond.c (usercrongroup_add): Return created crongroup. 
        Don't call watcher_add, leave it to the caller.
        (usercrongroup_delete): Same for watcher_remove.
        * src/watcher.c (watcher_add,watcher_remove): Remove prototypes.
        (watcher_add,watcher_remove): Now static.
        (event_handler): Call watcher_add and watcher_remove as needed.

2020-05-12  Sergey Poznyakoff  <gray@gnu.org>

        Support for new crongroup type: user-defined crongroup

        * src/micrond.c (NCRONID): Define here.
        (CRONTAB_UNSAFE): New code.
        (crongroup_option): Use the crongroup type for checking.
        (struct pwdbuf): New member grp.
        (priv_get_passwd): Rename to priv_getpwnam.
        (priv_getpwuid,priv_getgrgid): New functions.
        (crontab_stat): Special handling for CGTYPE_GROUP.
        (crontab_check_file): Bugfixes: return meaningful ppwd, use the
        crongroup type for checking for CGTYPE_SINGLE. Add special
        handling for CGTYPE_GROUP.
        (usercrongroup_add,usercrongroup_delete): New functions.
        (crongroup_parse): Rewrite crongroup security checking. Special
        handling for the CGTYPE_GROUPHOST type.
        * src/micrond.h (CRONID_*): Remove.
        (CGTYPE_DEFAULT, CGTYPE_SINGLE)
        (CGTYPE_USER,CGTYPE_GROUPHOST)
        (CGTYPE_GROUP): Crogroup types.
        (struct crongroup): New member: type, owner, gid.
        (watcher_add,watcher_remove): New protos.
        (usercrongroup_add,usercrongroup_delete): New protos.
        * src/watcher.c: Move ifd to the module top level.
        (watcher_add,watcher_remove): New functions.
        (event_handler): Handle user cron groups.

2020-05-11  Sergey Poznyakoff  <gray@gnu.org>

        Monitor changes in crontab and crongroup attributes and
        ownership

        * src/micrond.c (crongroups): New group "group", intended for
        future use.
        (crongroup_head): New global.
        (PARSE_CHATTR): New flag.
        (main): Join crongroups in a list.
        (struct crontab): Remove cid.  Replace it with "crongroup".
        (crontab_find): Change signature. All uses changed.
        (crontab_stat): New function.
        (crontab_check_file): Use crontab_stat.
        (crontab_parse): Change signature. All uses changed. Ignore call
        if the crongroup is marked as unsafe. Additional debugging
        messages.
        (crongroups_parse_all): New function.
        (crongroup_parse): Change signature. All uses changed. Mark the
        group with CGF_UNSAFE if it fails safety check. Otherwise, if it
        passes the check, decide whether to proceed rereading the file
        based on the CGF_UNSAFE crongroup flag and PARSE_CHATTR ifmod
        bit.  If the directory was marked as unsafe, but its attributes
        have been fixed, always load the file, since it was not loaded
        before or was unloaded when the attributes got broken. 
        Otherwise, reload the file only unless the PARSE_CHATTR bit was
        set.
        (crongroup_forget_crontabs)
        (crontab_chattr,crongroup_chattr): New function
        (crontab_deleted,crontab_updated): Change signature.
        (cron_thr_main): Use crongroups_parse_all.
        * src/micrond.h (CGF_UNSAFE): New flag.
        (struct crongroup): New members: list and wd.
        (crongroups): Remove extern.
        (crongroup_head): New extern.
        (crontab_deleted,crontab_updated): Change signatures.
        (crontab_chattr,crongroup_chattr): New protos.
        * src/watcher.c (watcher_setup): Rewrite.  The wd is now a
        member of struct crongroup.  Monitor the IN_ATTRIB event.
        (event_handler): Handle the IN_ATTRIB event.
        (watcher_run,cron_thr_watcher): Update.

2020-05-08  Sergey Poznyakoff  <gray@gnu.org>

        Use defines instead of the hardcoded envvar names.  Implement
        short help.


2020-05-08  Sergey Poznyakoff  <gray@gnu.org>

        Use crongroup flags to define crongroup properties


2020-05-08  Sergey Poznyakoff  <gray@gnu.org>

        Don't call micron_log from child processes


2020-05-08  Sergey Poznyakoff  <gray@gnu.org>

        Minor fix


2020-05-08  Sergey Poznyakoff  <gray@gnu.org>

        Bugfixes.

        * src/micron_log.c (log_message_create): Supply timestamp and,
        if logging to a INET socket, hostname.
        * src/micrond.c (crontab_parse): Skip whitespace after username
        field. Define SHELL.
        * src/runner.c: Include netdb.h (for HOST_NAME_MAX).

2020-05-08  Sergey Poznyakoff  <gray@gnu.org>

        Minor fix

        * src/micrond.c (crontab_check_file): Permission checking was 
        too strict

2020-05-08  Sergey Poznyakoff  <gray@gnu.org>

        Control log verbosity from the command line.

        * configure.ac: Require C99
        * src/micrond.c (log_level): New global.
        (stderr_log): Print the priority name
        (micron_log): Rename to micron_logger.
        (main): New option -l
        * src/micrond.h (micron_log): Rename to micron_logger.
        (micron_log): New macro.
        (log_level): New extern.

2020-05-08  Sergey Poznyakoff  <gray@gnu.org>

        Add missing copyleft


2020-05-08  Sergey Poznyakoff  <gray@gnu.org>

        Control the day semantics and multiple job instances

        * src/micron.c (micron_parse_timespec): Require day semantics to 
        be set on entry. Return MICRON_E_BADDSEM if it is not.
        (micron_dsem_str): New global.
        * src/micron.h (MICRON_E_BADDSEM): New error code.
        (micron_dsem_str): New extern.
        * src/micrond.c (crontab_parse): Take into account two new 
        environment variables. CRON_DAY_SEMANTICS controls the day field
        semantics. JOB_ALLOW_MULTIPLE tells whether running multiple
        copies of the same cronjob is allowed.
        * src/micrond.h (struct cronjob): New member: allow_multiple
        * src/runner.c (runner_start): Refuse to start job if its 
        instance is already running and JOB_ALLOW_MULTIPLE is not set

2020-05-08  Sergey Poznyakoff  <gray@gnu.org>

        Rename micronent to micronexp


2020-05-08  Sergey Poznyakoff  <gray@gnu.org>

        Implement Vixie and Dillon day field semantics

        * src/micron.c (micron_next): Implement Vixie and Dillon day
        field semantics
        * src/micron.h (struct micronent): New member dsem
        * tests/timetest.c: More tests.

2020-05-07  Sergey Poznyakoff  <gray@gnu.org>

        Minor changes

        * src/micron_log.h (ATTR_PRINTFLIKE): New macro
        (micron_syslog): Mark as printflike.
        * src/micrond.c (crongroup_parse,crontab_check_file): Fix file
        type and permission checks.
        * src/micrond.h (micron_log): Mark as printflike
        * src/runner.c: Fix arguments to micron_syslog.

2020-05-07  Sergey Poznyakoff  <gray@gnu.org>

        Implement @reboot entries.

        * src/micrond.c (running): New static.
        (cronjob_alloc): Take job type as argument. Insert reboot jobs
        before any other jobs.
        (crontab_parse): Call crontab_clear for CRONTAB_SUCCESS as well. 
        Parse @reboot lines.
        (cron_thr_main): Enqueue and remove @reboot jobs on startup.
        * src/micrond.h (struct cronjob): New member: type. Remove the
        "internal" member.
        * src/runner.c (runner_enqueue): Increase job reference counter
        here instead of doing it too late in runner_start.

2020-05-07  Sergey Poznyakoff  <gray@gnu.org>

        Rename micron_entry to micronjob


2020-05-07  Sergey Poznyakoff  <gray@gnu.org>

        Fix scheduling of the new entries from the modified crontabs.

        When using legacy mode (crontabs rescanned each minute), make
        sure any new entries matching the current minute are started
        immediately.

        When in inotify mode, apply the matching entries if re-reading
        the crontab at the very beginning of a minute.

        * src/micron.c (micron_next_time_from): New function.
        * src/micron.h (micron_next_time_from): New proto.
        * src/micrond.c (PARSE_APPLY_NOW): New flag.
        (cron_entry_insert): Additional parameter "apply_now".  If set, 
        configure next time counting from the previous minute, so that 
        if the entry's schedule matches the current minute, it will be 
        fired off immediately.  This is used when re-reading the
        crontabs.

        Insert entries in their natural order (as listed in the
        crontab), excepting internal ones, which are inserted before any
        entries with equal next_time value.
        (crontab_parse): Take into account the PARSE_APPLY_NOW bit, when
        calling cron_entry_insert.
        (crontab_updated): Apply changes now, if invoked at the very 
        beginning of the minute (second 0).
        (cron_thr_main): Raise the PARSE_APPLY_NOW bit when re-reading 
        modified crontabs.

2020-05-07  Sergey Poznyakoff  <gray@gnu.org>

        Bugfix

        * src/list.h (list_head_remove): Reinitialize head

2020-05-06  Sergey Poznyakoff  <gray@gnu.org>

        Configurable syslog redirection

        * src/micron_log.c (micron_log_enqueue): Supply the default 
        facility if none is explicitly specified.
        (micron_log_str_to_fac,micron_log_str_to_pri)
        (micron_log_fac_to_str,micron_log_pri_to_str): New functions.
        * src/micron_log.h: Add the corresponding prototypes.
        * src/micrond.c (syslog_facility): New global.
        (main): New option -F sets the default syslog facility for 
        logging jobs' outputs.
        (envc_free): New function.
        (micron_environ_free): Don't assume NULL-terminated array
        (micron_environ_find): Accept NULL as the ret argument.
        (micron_environ_finish): Remove.
        (micron_environ_set_var): New function.
        (micron_environ_copy): Take variable count as an argument. Cut
        at the first NULL variable or when the count is exhausted, 
        whichever happens first. Fix precedence rules (inverted
        previously).
        (micron_environ_set): Change type of the first argument. Use
        micron_environ_set_var instead of the micron_environ_append_var.
        (crontab_find): Provide initial environment (can be NULL).
        (crontab_clear): New function.
        (crontab_forget): Rewrite using crontab_clear.
        (crontab_parse): Clear all environments except the built-in one 
        before reparsing. Special handling for the SYSLOG envar.
        * src/micrond.h (syslog_facility): New proto.
        * src/runner.c (runner_start): Use the SYSLOG envar to decide
        whether to send the job's output to syslog and to which
        facility.
        (cron_thr_logger): Read the facility from struct proctab

2020-05-06  Sergey Poznyakoff  <gray@gnu.org>

        Use symbolic exit codes


2020-05-06  Sergey Poznyakoff  <gray@gnu.org>

        Change command line options.

        * src/micrond.c (main): Remove -C, and -c options.  Reassing
        -s to "enable syslog" option. New options: -g (set crontab
        group) and -p (set syslog socket). Use micron_syslog for logging
        in daemon mode.
        * src/micrond.h (struct crongroup): New member: id

2020-05-05  Sergey Poznyakoff  <gray@gnu.org>

        Initial implementation of syslog reporting

        * configure.ac: Check for ranlib
        * src/Makefile.am: Build a convenience library to simplify
        testing.
        * src/micron_log.c: New file.
        * src/micron_log.h: New file.
        * src/micrond.c (syslog_enable): New global.
        (main): New option -S.
        (catfilename): New function.
        (priv_get_pwdbuf): Initialize allocated memory to 0s.
        * src/micrond.h (syslog_enable): New extern.
        * src/runner.c  (cron_thr_runner): Bugfix: drain the runner 
        queue when finshed waiting on runner_cond.
        (struct proctab): Use file descriptor instead of FILE *
        (proctab_alloc): Initialize allocated memory.
        (proctab_remove,proctab_remove_safe): New functions.
        (proctab_lookup_safe): New function.
        (runner_start): If syslog reporting is required, open a pipe to 
        the program's stdout and stderr. Start the logger thread before 
        signalling the runner. Use mkstemp instead of tmpfile.
        (cron_thr_cleaner): Dont't wait when there are no children 
        running.
        (cron_thr_logger): New function.

        * tests/Makefile.am: Use ../src/libmicron.a
        * tests/logger.c: New file.

2020-05-05  Sergey Poznyakoff  <gray@gnu.org>

        Minor fixes


2020-05-05  Sergey Poznyakoff  <gray@gnu.org>

        Re-enable tests


2020-05-05  Sergey Poznyakoff  <gray@gnu.org>

        Mail results to the user if required


2020-05-05  Sergey Poznyakoff  <gray@gnu.org>

        Minor changes


2020-05-04  Sergey Poznyakoff  <gray@gnu.org>

        Implement incremental environments

        * src/Makefile.am: Add runner.c
        * src/runner.c: New file.
        * src/list.h (LIST_HEAD_ENQUEUE,LIST_HEAD_DEQUEUE)
        (LIST_FOREACH_FROM,LIST_FOREACH_FROM_SAFE)
        (LIST_FOREACH_REVERSE_SAFE)
        (LIST_FOREACH_FROM_REVERSE_SAFE): New macros.
        * src/micrond.c: Rename crondef to crongroup. All uses changed.
        (main): Create runner and cleaner threads.
        (micron_environ*): Functions for handling incremental
        environments.
        (crontab_parse): Parse environment variable assignments.
        * src/micrond.h (struct micron_entry): New members: env and 
        runq.
        (cron_thr_runner,cron_thr_cleaner)
        (runner_enqueue)
        (memrealloc,parsefilename): New protos.

2020-05-04  Sergey Poznyakoff  <gray@gnu.org>

        Detect crontab modifications


2020-05-04  Sergey Poznyakoff  <gray@gnu.org>

        Start writing micrond


2020-04-29  Sergey Poznyakoff  <gray@gnu.org>

        Initial commit


Local Variables:
mode: change-log
version-control: never
buffer-read-only: t
End:

 Copyright (C) 2020-2024 Sergey Poznyakoff

 GNU micron is free software; you can redistribute it and/or modify it
 under the terms of the GNU General Public License as published by the
 Free Software Foundation; either version 3 of the License, or (at your
 option) any later version.

 GNU micron is distributed in the hope that it will be useful,
 but WITHOUT ANY WARRANTY; without even the implied warranty of
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 GNU General Public License for more details.

 You should have received a copy of the GNU General Public License along
 with GNU micron. If not, see <http://www.gnu.org/licenses/>. */
