
Ask HN: What do you use bash scripts for? - fasteo
Just curious after finding myself using them more often in our production environment, usually triggered by a cron job. We use them mostly to aggregate data, generate reports, check operational thresholds, etc.
======
simonblack
Any job that needs to be done once a month at least, or more often than that,
should be organised into a script.

Any job that is too complex to rely on the user's memory, should be organised
into a script.

Examples: all cron jobs, all daily jobs like backups and rsyncing file-
storage. (Mind you, there's a lot of overlap in those two categories.)

Other examples:

rebuilding a new system by automating the selection and installation of wanted
packages instead of doing that by hand;

mounting specific filesystems from a variety of places like other hosts on the
internet, or specific storage devices, at prespecified mountpoints;

fixing problems that crop up periodically in the system;

converting a whole bunch of media files from one format to another, especially
where there are zillions of options for that conversion software;

etc, etc, etc,

Think of scripts as a way to 'set and forget', or a way to save you the
trouble of working out how to fix a problem more than once, or a way to
improve your cron jobs.

(did you know you can improve many cron jobs by the mere expedient of setting
the cron-job environment variables? Then you can use the exact same script as
a normal CLI script or as a cron job with the script knowing how it was
launched and behaving differently to suit.)

