Knowledgebase

Writing Reliable Operational Scripts Print

  • devopsinfrastructure, devops, diskspace, errors, permissions, guide, howto, solution
  • 0

Scripts you can trust.

WHAT A RELIABLE SCRIPT DOES

States what it is doing Stops on the first failure Leaves things consistent if interrupted Is safe to run again Logs enough to diagnose

WHAT TO SET AT THE START

Strict failure behaviour, so an error stops the script rather than continuing.

WHY

Otherwise a failed step is followed by steps assuming it succeeded.

WHAT TO CHECK BEFORE STARTING

Preconditions: required files, permissions, connectivity, disk space

WHAT TO BUILD IN

A mode that reports without acting Confirmation for anything destructive Bounds on how much a single run may affect

WHAT TO AVOID

Assuming a command succeeded Assuming a path exists Hard-coded paths and hostnames

WHAT TO PARAMETERISE

The environment, so the same script serves each.

WHAT TO RETURN

A meaningful exit status.

WHY

So whatever called it can tell whether it worked.

WHAT TO TEST

The failure paths, by making things fail deliberately.


Was this answer helpful?
Back

Are you happy with your experience? Leave us a review on Trustpilot.


Trustpilot