Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

61 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Tiny task manager for Linux, MacOS and Unix-like systems.
Written as a single Python script.

Installation

Download the script directly (recommended):

curl https://raw.githubusercontent.com/yuriescl/tinytaskmanager/dev/tinytaskmanager.py -o tinytaskmanager
chmod +x tinytaskmanager
./tinytaskmanager

Alternative installation methods

Installing through pip

pip install tinytaskmanager
tinytaskmanager  # or python -m tinytaskmanager

Requirements:

  • python >=3.8
  • ps (usually available by default)

Features:

  • No root access required
  • Daemon-less
  • Easily start, watch, and stop tasks using very simple and direct CLI commands
  • Written as a single script built using only the Python standard library - easy to audit and run

Comparison to other popular server task managers:

  • systemctl
    • Pros
      • Sophisticated dependency management via WantedBy
      • Works well with system services
      • Usually installed by default in any modern server
      • Many advanced options, useful for fine-grained control of system services
    • Cons
      • Unit files are required every time you need to setup a simple background task
      • Difficult to work with when you're not the root user (systemctl --user is not so simple to use)
      • If not installed in the system, can be difficult to install and setup as a non-privileged user
      • Difficult for beginners and non-sysadmins
  • supervisord
    • Pros
      • Very advanced and fine-grained control of tasks, similar to systemctl
    • Cons
      • Not usually installed by default in modern servers
      • Even if installed, usually requires root access
      • Difficult for beginners and non-sysadmins
  • pm2
    • Pros
      • Modern codebase (JavaScript)
      • Can be easily installed via npm install pm2
      • Has advanced integration with Node.js programs (cluster mode, load balancing, etc)
      • Widely known and used in Node.js ecosystem
    • Cons
      • Not usually installed by default in modern servers
      • Might not work so well with non-Node.js software
      • Requires node and npm to be installed
      • Might consume more RAM than intended since it's JavaScript
      • Can be a bit difficult to setup and run simple tasks
  • docker
    • Pros
      • Quickly spin up a development/production instance given a properly configured Dockerfile
      • Container/Dockerfile can be easily shared accross a development team so everyone can test in same OS environment
      • Widely available and used across many different platforms
      • All dependencies can be installed in the container
    • Cons
      • Requires root access
      • Usually the processes run as the root user, which can lead to major security vulnerabilities
      • Very hard for beginners and non-sysadmins
      • Difficult to run simple tasks that don't need containers

tinytaskmanager (previously named ttm) was initially an attempt (after painfully having to deal with the existing options like PM2, systemctl, etc) to have a script I could easily copy to a server and manage simple tasks like a gunicorn server, or a celery worker. After a while, tinytaskmanager became a very useful tool in day-to-day deployments, so it made sense to make it public.

Examples

Running a script:

$ tinytaskmanager run ./backup-database.sh --output /backups/database.sql
$ tinytaskmanager ls
ID   NAME COMMAND                                              UPTIME PID    
1    -    ./backup-database.sh --output /backups/database.sql  2s     742537 
$ tinytaskmanager stop 1
$ tinytaskmanager rm 1

Running Django server:

$ tinytaskmanager run --name mydjangoserver python manage.py runserver
$ tinytaskmanager rm mydjangoserver
Cannot remove task while it's running.
To stop it, run:
tinytaskmanager stop mydjangoserver
$ tinytaskmanager logs mydjangoserver
$ tinytaskmanager rm mydjangoserver

Development

Environment

poetry env use python3.8
poetry install
poetry shell

About

Tiny daemon-less task manager for Linux, MacOS and Unix-like systems. Written as a single Python script.

Topics

Resources

Stars

Watchers

Forks

Releases

Sponsor this project

Used by

Contributors

Languages