It is always a struggle configuring a cronjob to run certain scripts; there is always a mis configuration, a PATH, an environment variable that is different from when you use it in interactive mode, e - eviltoast

It is always a struggle configuring a cronjob to run certain scripts; there is always a mis configuration, a PATH, an environment variable that is different from when you use it in interactive mode, etc… Do you have any tricks to avoid or minimize those issues?

cc @selfhost@lemmy.ml

  • Lupec@lemm.ee
    link
    fedilink
    arrow-up
    1
    ·
    edit-2
    1 year ago

    I basically combine a few mechanisms to mitigate that:

    • Having cron call scripts deployed to a fixed location I can manually test or use on demand as needed
    • Piping each script’s output/exit code to healtchecks.io so I can get feedback notifications when/if they fail
    • Using Ansible to deploy everything so it’s all repeatable and version controlled