Hands-on task
This task is step 12 of the course “Processes and signals”
trap: cleanup on exit
Write a script /root/cleanup.sh that creates a lock file /root/tmp.lock, and on termination (the EXIT signal) removes it via trap. After running the script, no lock file should remain.
Reference:Exit codes
What you'll practise:
- trap
- EXIT signal
- bash script
- resource cleanup
- lock file