A lightweight daemon and service manager that executes shell commands at sub-second intervals. Standard cron only supports minute-level granularity -- frequent-cron supports millisecond precision. Runs on Linux, macOS, FreeBSD, and Windows.
By default, command execution is blocking (synchronous): if a command takes longer than the configured interval, the next execution waits until the previous one completes. For example, a 500ms interval with a command that takes 3 minutes will effectively run once every 3 minutes.
You can set --synchronous=false to run commands asynchronously. Warning: running asynchronously can cause unbounded resource growth if the script never exits or is called too frequently (e.g. consuming too many database connections or too much memory). Synchronous (the default) is the safer option.
Licensed under the MIT License.
See platform-specific install instructions in docs/.
git clone https://github.com/homer6/frequent-cron.git
cd frequent-cron
cmake .
make
make test
sudo make installfrequent-cron run --frequency=1000 --command="/path/to/your/script.sh" --pid-file=/var/run/frequent-cron.pidOr using legacy mode (backward compatible):
frequent-cron --frequency=1000 --command="/path/to/your/script.sh" --pid-file=/var/run/frequent-cron.pidTo stop:
kill $(cat /var/run/frequent-cron.pid)Register, start, monitor, and stop services by name:
# Install a service
frequent-cron install myservice --frequency=1000 --command="/path/to/script.sh"
# Start it
frequent-cron start myservice
# Check status
frequent-cron status # all services
frequent-cron status myservice # specific service
# View logs
frequent-cron logs myservice
# List all services
frequent-cron list
# Stop and remove
frequent-cron stop myservice
frequent-cron remove myserviceThe install command also creates platform-native service definitions:
- Linux: systemd unit files
- macOS: launchd plists
- FreeBSD: rc.d scripts
- Windows: Windows Service (SCM) entries
| Option | Description |
|---|---|
--frequency |
Interval in milliseconds between command executions |
--command |
Shell command to execute |
--pid-file |
Path to write the daemon's PID (optional) |
--synchronous |
Set to false for async execution (default: true) |
--data-dir |
Override the data directory path |
--help |
Display help |
- macOS: See docs/macos.md
- Ubuntu/Debian: See docs/ubuntu.md
- FreeBSD: See docs/freebsd.md
- Windows: See docs/windows.md
Full documentation is available in docs/wiki/: