npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

cli-cron-scheduler

v1.0.3

Published

A CLI utility for scheduling cron jobs that executes shell scripts.

Readme

🕰️ Cron Scheduler CLI

By Diego Felipe ([email protected])

A powerful and flexible CLI tool to schedule cron jobs, handle retries, log outputs, and send email notifications on failures or specific outputs.

🚀 Features

  • Schedule Cron Jobs with custom scripts.
  • Retry Mechanism for failed jobs.
  • Email Notifications on failure or specific output conditions.
  • Logging of job outputs to a file.

⚙️ Installation

npm install -g cron-scheduler

🔧 Setup

  1. Create a .env file in your project root based on the provided .env.sample:
SMTP_HOST=smtp.example.com
SMTP_PORT=465
[email protected]
SMTP_PASS=your-email-password
  1. Ensure that your shell script files have executable permissions:
chmod +x your-script.sh

📖 Usage

1. Schedule a Job

cron-scheduler schedule ./backup.sh "0 0 * * *" --log ./backup.log --on-fail-email [email protected] --retry 3 --on-output "success:notify,fail:retry"
  • ./backup.sh: Path to your shell script.
  • "0 0 * * *": Cron expression (daily at midnight).
  • --log: (Optional) Path to the log file.
  • --on-fail-email: (Optional) Email address to notify on failure.
  • --retry: (Optional) Number of retry attempts on failure.
  • --on-output: (Optional) Define output conditions and actions.
    • Example: "success:notify,fail:retry"

✅ Examples

Example 1: Basic Job with Logging

cron-scheduler schedule ./script.sh "*/5 * * * *" --log ./script.log
  • Runs the script every 5 minutes and logs the output.

Example 2: Notify on Failure

cron-scheduler schedule ./script.sh "0 1 * * *" --on-fail-email [email protected]
  • Runs the script daily at 1 AM and sends an email if it fails.

Example 3: Retry on Failure and Notify on Success

cron-scheduler schedule ./script.sh "0 12 * * 1" --retry 2 --on-output "success:notify"
  • Runs every Monday at noon, retries twice on failure, and notifies on success.

📄 Environment Variables

Ensure these are correctly configured in your .env file:

  • SMTP_HOST: SMTP server host.
  • SMTP_PORT: SMTP server port (e.g., 465 for SSL).
  • SMTP_USER: SMTP username (usually your email).
  • SMTP_PASS: SMTP password.

❓ Troubleshooting

  • Email Not Sending: Check SMTP configurations in your .env file.
  • Script Not Executing: Ensure the script has executable permissions (chmod +x).
  • Global CLI Not Recognized: Try re-installing globally with npm install -g cron-scheduler and ensure your system PATH includes npm global binaries.

📬 Contributions

Pull requests are welcome! For major changes, open an issue first to discuss what you would like to change.


📄 License

MIT