Skip to content

Simple job queue in bash using atd. Because cron is not a job queue.

License

Notifications You must be signed in to change notification settings

varas/bash-work-queue

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 

Repository files navigation

bash-work-queue

Simple job queue in bash using atd for Linux.

Because cron is not a job queue.

bash-work-queue will run a set of scripts defined on a jobs file:

  • one by line
  • in batch mode
  • on a predefinied interval
  • when the cpu usage lowers a predefinied threeshold

Install

Optional. You can place workqueue.bash in /etd/init.d/ and get it started at boot time.

Download and install as a service:

wget https://raw.githubusercontent.com/varas/bash-work-queue/master/workqueue.bash -O /etc/init.d/workqueue.bash
chmod +x /etc/init.d/workqueue.bash

Configure and launch:

service workqueue.bash start

Configuration

Set up your jobs on a plain text file, one task by line. Example:

/path/to/script1.sh
sudo -u otheruser nice -n 15 /path/to/script2.sh

Tune up the config variables on the file:

JOBS_FILE='/path/to/your/workqueue.jobs'
# load_avg maybe be something like: number of cores - 1
LOAD_AVG=3
# minimum interval in seconds between the start of two batch jobs
TIME_WINDOW=30

Usage

You can run it manually:

/path/to/workqueue.bash [start|stop|status|dump TASK_ID]

Or in case you have placed it at /etd/init.d/ you can run it as a service:

service workqueue.bash [start|stop|status|dump TASK_ID]

Note

bash-work-queue gets queued itself in order to respawn the workqueue and is treated as a last job item.

About

Simple job queue in bash using atd. Because cron is not a job queue.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages