Skip to content

xtrepo/shell-jobs

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

shell-jobs

Cron replacement in NodeJS, made for humans.

.jobs files look like this;

echo `date '+%d %h %H:%M'` > /tmp/now # => 1 second
echo "Hello World" # => 5 seconds
echo "Hello Kitty" # => 4 hours

And runs like this;

Install

$ npm install -g shell-jobs

Usage

Create a new file and call it new.jobs

echo "every 3.5 hours" >> /tmp/logs  # => 3 hours 30 seconds
echo "every 5 minutes" >> /tmp/logs  # => 5 minutes
echo "this is a new day!"            # comments here are ok. => 24 hours
echo "every 4 weeks" >> /tmp/logs    # => 4 weeks

Then run it;

$ shell-jobs new.jobs # globbing enabled

Process outputs are hidden by default. Use --out to print the stdout of certain jobs;

$ shell-jobs new.jobs -o 3 # will be printing the stdout of the third job 'echo "this is a new day!"'

Wanna run it as a daemon on the background?

$ shell-jobs new.jobs -d

Manual


    USAGE

        shell-jobs [files] [options]

    OPTIONS

        -d    --daemon     Run as daemon on the background.
        -s    --stop       Stop the running daemon.
        -o    --out        Show outputs from the commands at specified index(es). e.g -o 0, 2, 3
        -v    --version    Show version and exit
        -h    --help       Show help and exit

Coded by BlackBear

Pull requests are welcome

About

Cron replacement in NodeJS

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published