Giter VIP home page Giter VIP logo

simple-python-scheduler's Introduction

A simple task scheduler

This is a simple task scheduler implemented in python3

It allows to schedule console commands to be run at specific intervals. The results of execution can later be viewed in the application, also they are sent via email.

Installation

Clone project with git or download source archive.

From the project root folder, run:

pip install .

This will install all dependencies and create schedulr binary somewhere in system-searchable path. If not using in virtualenv, respective admin rights might be needed for installation (sudo on Linux, admin shell on Windows).

To remove, call

pip uninstall schedulr

Usage

Running schedulr will start the schduler application. While it is running, it will execute the programs you add to schedule. To do that, use the provided command-line interface.

The supported commands are:

  • Add new command with running interval: add <run interval in seconds> <command>
  • Add new command with crontab-like schedule: add <* * * * *> <command>
  • Show latest executed commands: log <number of commands to show, default 10>
  • Show commands to be executed: backlog <number of commands to show, default 10>
  • Help: help or ?
  • Exit: q or OS-specific EOF (Ctrl-D or Ctrl-Z + Enter)

Example:

root@790f5d4f8af1:/data# schedulr
Python task scheduler. Type help or ? to list commands
schedulr: add 10 pwd
Added job with command "pwd"
schedulr: log
Showing last 2 reports
03/10/22 08:56:38 -- 03/10/22 08:56:38  "pwd"  /

03/10/22 08:56:48 -- 03/10/22 08:56:48  "pwd"  /

schedulr: backlog 5
Showing upcoming 5 jobs
03/10/22 08:57:28 "pwd"
03/10/22 08:57:38 "pwd"
03/10/22 08:57:48 "pwd"
03/10/22 08:57:58 "pwd"
03/10/22 08:58:08 "pwd"

Configuration

Email notifications will not work without correct configuration. SMTP server address, port and credentials need to be set, as well as sender and recipient email addresses. This configuration is read from file config.cfg in current working directory. Another file can be specified by command-line argument, i.e. schedulr --cfg ~/config.txt. If --cfg is not provided and there is no config.cfg in current directory, hard-coded defaults are used.

Example config.cfg is in the root of the project. The format of the file is INI-like and is self-explanatory.

You can test email functionality by starting python's built-in SMTP server by

python -m smtpd -n -c DebuggingServer localhost:1025

Default configuration will connect to this server. Note that it does not support username/password, so leave them empty in config.

simple-python-scheduler's People

Contributors

positron96 avatar

Watchers

 avatar  avatar

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.