Coder Social home page Coder Social logo

crond's Introduction

Along Crond: Standalone Task Management

  • Another crontab for executing recurring tasks
  • Only one task with the same name can exist at a given time

Dependencies

  • bash
    • sleep usleep bc cut
  • php-cli

Usage

# See example.ini
vim mytasks.ini
chmod +x crond.sh
crond.sh start mytasks.ini

Background

  • Single Machine, Multiple Applications
    • Due to centralized deployment, several projects (php/slim, php/webman, go/somer, go/ginping, python/kingpin X2) are deployed on the same machine. Of course, not all of them are docker containers; the tasks come in various flavors.
    • Why not separate deployments? The machine has 32 cores and 64GB memory, which might not be attainable in a cloud service.
  • Insufficiency of crontab
    • Cron does not care if the previous run of the same task has completed when a new instance starts. When a task starts, I want the previous one to have completed and exited.
    • Crontab has another issue. When NTP synchronized time exceeds 1 second, the scheduled tasks will no longer run.
  • Solution from a Decade Ago
    • Perhaps supervisor is more suitable, but the configuration is relatively cumbersome.
    • Digging out a solution from ten years ago, utilizing bash while loop to control the loop, with some modifications it works fine. Let's go with it.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.