I have a script that takes about 45 seconds to run. How can I disable Ctrl-c and Ctrl-z while a script is running?
Although you could disable Ctrl-c and Ctrl-z by disabling those terminal settings or setting the terminal to raw more or other solutions, you are usually much better off leaving them enabled and reacting to the resulting signals instead. You can install handlers for the signals and let the handlers do nothing.
The way to install handlers depends on the programming language you are using. You haven't said what you are using but here are a few examples:
#!/bin/sh trap '' INT TSTP
#!/usr/bin/python import signal signal.signal(signal.SIGINT, signal.SIG_IGN) signal.signal(signal.SIGTSTP, signal.SIG_IGN)