Skip to main content

Cronify is a file event based task scheduler that uses the Linux kernels’ inotify API. An Inotify cron implementation if you will.

It allows for triggering of actions when a file event occurs, with configurable action parameters that can be file data such as file name and file datetime and for scheduling actions to be run within a certain time period among other things.

Once installed, it is run as a service, or daemon, much like cron itself. Cronify may also be used as a python library.

The service’s configuration is YAML based.

https://api.travis-ci.org/pkittenis/cronify.png?branch=master

Installation

Requires a running Linux kernel >=2.6.13

$ sudo pip install cronify
$ sudo chmod +x /etc/init.d/cronifyd
# Install a /etc/cronify.yaml file as in the examples below
# Once a configuration file is in place, start the cronify daemon with the provided init script
$ sudo /etc/init.d/cronifyd start

Configuration Example

$ cat /etc/cronify.yaml

/tmp/testdir :
    name : Access log watcher
    recurse : false
    filemasks :
      somefile.* :
        actions :
          - processFile :
              args:
                - $filename
                - YYYYMMDD
              cmd: echo
$ sudo /etc/init.d/cronifyd start
$ touch /tmp/testdir/somefile.txt
$ tail /var/log/cronify/cronify.log

cronify.cronify - Thread-1 - 2013-03-26 17:40:40,485 - INFO - Got result from action {'cmd': 'echo', 'args': ['echo', '/tmp/testdir/somefile.txt', '20130326']} - /tmp/testdir/somefile.txt 20130326

More complex configuration with multiple watchers and delayed actions

See example.yaml in repository for complete list of accepted configuration

$ cat /etc/cronify.yaml

/tmp/testdir :
    name : Access log watcher
    recurse : false
    filemasks :
      access_log_YYYYMMDD.* :
        actions :
          - processFile :
              args:
                - $filename
                - YYYYMMDD
              cmd: process

/tmp/testdir2 :
    name : Other log watcher
    recurse : true
    filemasks :
      other_log_YYYYMMDD.* :
         actions :
          # Actions to perform on the file in sequence.
          - processFile :
            # Do not start action before this time. Action is queued until start_time if triggered prior to it.
            # This configuration setting is optional
            start_time: 0800
            # Do not start action after this time. Action is queued until next start_time if triggered after end time
            # This configuration setting is optional
            end_time: 1000
            args:
              - $filename
              - YYYYMMDD
            cmd: process

Known limitations

  • Currently queued actions will be _lost_ upon a service restart.

  • When using recurse, inotify is limited to watching N number of subdirectories in the tree, where N is value of /proc/sys/fs/inotify/max_user_watches. See http://linux.die.net/man/7/inotify

    User can increase this limit by modifying /proc/sys/fs/inotify/max_user_watches

  • When watching an NFS directory on NFS server side, only events made by the NFS server will be seen by the inotify API and following, cronify itself.

    When watching an NFS directory on NFS client side, no events are seen by inotify at all.

    In other words if you were planning on watching for a file that is created by an NFS client, this is currently not possible.

githalytics.com

Release files for cronify 0.13

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for cronify 0.13
File Size Uploaded
cronify-0.13.tar.gz 12.7 kB Details

Built distributions (wheels)

Table of built distributions (wheels) for cronify 0.13
File Interpreter ABI Platform
cronify-0.13-py3-none-any.whl Python 3 none any Details
cronify-0.13-py2-none-any.whl Python 2 none any Details

Total release size: 57.6 kB

Release files / cronify-0.13.tar.gz

Download URL cronify-0.13.tar.gz
Size 12.7 kB
Tags Source
SHA-256 checksum
How to use checksums
2a4f7690a1d23add92a91026bccd7303e6682cf3cabfa1d97bef495dec108114
BLAKE2b-256 checksum
How to use checksums
36340c8f2d8fafbc6686fc883d5048961daaf42bfd6c630ecb3027dd8780b5cd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / cronify-0.13-py3-none-any.whl

Download URL cronify-0.13-py3-none-any.whl
Size 28.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
6fbd676ecb1716ade159c5e4d9469df91534b83c28f034549235b1f09a0161d5
BLAKE2b-256 checksum
How to use checksums
31c997fa09d67f74eb40191b93fbedeb4dd511691f66e7a6b04782663ceecb26
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / cronify-0.13-py2-none-any.whl

Download URL cronify-0.13-py2-none-any.whl
Size 16.0 kB
Tags Python 2
SHA-256 checksum
How to use checksums
c2fbfa861da0895f1f388f892bc89b1f383d6a7d61c40d60e192beb1ddf658e8
BLAKE2b-256 checksum
How to use checksums
8c5f95b9c4e10f15724ee0660072f167ad5a1d2e499ec186480af123c6a58ba7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

This release

0.13 This release

3 release files

0.12

1 release file

0.1

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page