Scripts That Run Without You

cron runs a script from your home folder, with a short PATH, no terminal and no keyboard, so a script that works when you type it can fail at 18:00; give it full paths and a PATH of its own, write everything to a log with the date and time, never ask a question, and take a lock with flock so two copies never run at once.

Updated

Cheat sheet for the lesson Scripts That Run Without You: cron runs a script from your home folder, with a short PATH, no terminal and no keyboard, so a script that works when you type it can fail at 18:00; give it full paths and a PATH of its own, write everything to a log with the date and time…
Category
Bash
Level
Freelancer
Tags
absolute-path, environment-variable, file-lock, flock, linux, log-file, path, unix