Note that this is very purpose-built. The job args in particular depend on a unique key being in the first position.
There is also plenty of brittle code all over the place.
Instead, use this as a guide for how you might build your own. A lot of the parts are the same between implementations.
Oh, duh, you need to install it too: