in ,

In search of a better job scheduler | beepb00p, Hacker News


    

What if cron and systemd had a baby? Wouldn’t it be beautiful?          

    

To support my personal infrastructure, I need a fair amount of regular automatic jobs:

  • for exportingmy personal datafrom the cloud
  • for generatingplaintextviews of my digital trace
  • for updating mytodo lists
  • lots of other backups and supplementary scripts
  • Running all that manually (more than scripts across all devices) is an awful job for a human. I want to set them up once and more or less forget about it, only checking now and then.

    In addition, I am trying to share my knowledge with other people, and it turns out not many people (even programmers, let alone less technical people) are using scheduling software in a personal capacity. So in this post I’ll be speculating why it’s hard and how to make it easier.

    I’ll be considering pros and cons of job scheduling software mostly with theemphasis on thepersonal infrastructureI’m sure there will be some aspects I’m missing out on, more specific to industrial-scale job management.

    (1) ****************** (1) ******************** (cron)

    Pros:

    • Once you get used to the cron scheduling syntax, it’s very easy to actually add new jobs.
    • easy to adjust

      You just type

      crontab -e, and you can insert / delete / comment jobs, overview when they are running, and space them out in time if necessary. Once you saved the crontab and exited, it’s applied immediately

    • even though systemd is present in most desktop Linux / Mac distributions, cron willdefinitelybe there

      This probably does not matter if you’re using a general purpose Linux distribution.

    • Cons: anything else you can think of is extremely tedious and repetitive to achieve in cron.

      • no periodic (i.e. ‘once a day’ scheduling), only supports specific time

        This is annoying when if you don’t keep your computer always on.

      • no job dependencies
      • no timeouts and generally no means of resource management
      • no restart policies
      • no means of failure notifications apart from local email
      • logs go to local mail by default and there are no other mechanisms of notification
      • some bad defaults

        Fun fact: cron only emails you if the job has produced output. If your job failed with nonzero exit code but produced no output you’d never find out.

      • Cron has some variations that help with some of these problems: