Ravindra BagaleCourses & study guides मराठी Track your progress

Ravi Sir's Cards › AWS

AWS Cloud

trap cleanup

This revision card explains trap cleanup. It starts from the need that scripts must clean up always. It describes trap runs code on a signal. The how-to section notes EXIT covers normal and error exits. An example on the card is remove the lock file.

trap cleanup Scripts must clean up always. trap runs code on a signal. EXIT covers normal and error exits. Remove the lock file.
trap cleanup · Download PNG
Read card text

What this card says

Why do we need it?

Scripts must clean up always.

What is it?

trap runs code on a signal.

How to do it

EXIT covers normal and error exits.

Example

Remove the lock file.

trap 'rm -f /tmp/job.lock' EXIT

See all AWS revision cards