Stop Cleanly on SIGTERM
/home/student/bin/worker.sh processes the files in /home/student/queue-lantern/in/, one at a time: it copies a file to work/, "processes" it (about 2 seconds), moves the result to done/ and deletes the input. When a deploy stops it with SIGTERM, it dies wherever it is, leaving half-written files in work/ and items processed twice after a restart.
Change worker.sh so that when it receives SIGTERM:
done/, its input is removed, work/ is empty),stopped after N items to /home/student/queue-lantern/worker.log (N = items finished in this run) and exits 0.Without a signal, it keeps processing until in/ is empty, then exits 0.
About this machine
Ubuntu 24.04 with no internet access. You are student with passwordless sudo. The grader checks the final state of the machine, not the commands you typed. Values like names and ports are generated for you.
Part of Shell Scripting for Automation
Teaching or writing about this? Embed this lab on your page
Your machine is ready to start
A fresh, isolated Ubuntu machine boots in a few seconds with the task already set up.
No account needed: 3 of 3 free tries left. Guest machines last 30 minutes.