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

  • thisisawayoflife@lemmy.world
    link
    fedilink
    arrow-up
    1
    ·
    1 year ago

    Wrap all the cron job tasks in a bash script and make sure it works. Call the script directly in the cron configuration. Dump the output of the cronjob to a logfile. Set it up to run every minute so you can ensure it works via the cron environment.