3 ms·
Certain types of script really really really should always start with alarm 10 or similar. This has saved me from myself way too many times.
by mst 9y ago
Certain types of script really really really should always start with
alarm 10
or similar. This has saved me from myself way too many times.
- cpach 9y agoWhat does that do?
- jey 9y agoProbably sends a SIGALRM signal in 10 seconds. https://linux.die.net/man/2/alarm https://linux.die.net/man/2/alarm
- mst 9y agoWhich, if you haven't taken precautions to make it otherwise, will shoot your process in the head. "Dear operating system, please shoot me in the head in ten seconds if I haven't already finished" is a really useful thing to ask for sometimes.
- rambojazz 9y agoIt's a way to send a SIGALRM signal to your running process [1] using the alarm() syscall. You can also catch the signal [2] and act upon. For example it's used by "timeout" [3]. [1] https://dokk.org/manpages/alarm.2#DESCRIPTION https://dokk.org/manpages/alarm.2#DESCRIPTION [2] https://dokk.org/manpages/sigaction.2#DESCRIPTION https://dokk.org/manpages/sigaction.2#DESCRIPTION [3] https://git.savannah.gnu.org/cgit/coreutils.git/tree/src/timeout.c?h=v8.29#n18 https://git.savannah.gnu.org/cgit/coreutils.git/tree/src/tim...