Tagged Questions
5
votes
1answer
355 views
“trap … INT TERM EXIT” really necessary?
Many examples for trap use trap ... INT TERM EXIT for cleanup tasks. But is it really necessary to list all the three sigspecs?
The manual says:
If a SIGNAL_SPEC is EXIT (0) ARG is executed on ...
3
votes
3answers
2k views
How to stop the loop bash script in terminal?
For example,
#!/bin/bash
while :
do
sl
done
How to terminate this bash script?
2
votes
1answer
147 views
Why doesn't an orphan process receive signals?
I have two shell scripts: launch_job.sh and sub_job.sh.
If launch_job.sh uses the following method to run sub_job.sh:
nohup sub_job.sh &
sub_job.sh becomes an orphan, i.e. with PPID 1.
I ...
3
votes
2answers
1k views
How can I trap a program that returns 139 (segmentation fault) in bash?
I have a bash script that tests some programs and one of the program returns Segmentation fault so I tried to add a trap in the head of my script:
trap "echo 'segfault occured!'" SIGSEGV
That ...
3
votes
2answers
365 views
Wrapper program that sets signal handler
I would like to have a wrapper program that runs a given command and sets a signal handler so that it gets run when the command receives a specified signal.
The question is this:
Is there an ...
2
votes
1answer
1k views
What is signal 0 in a trap command?
I'm following this guide on how to set up passwordless SSH authentication with ssh-agent.
To start up ssh-agent the author recommends the following code in .bash_profile:
SSHAGENT=/usr/bin/ssh-agent
...
1
vote
2answers
821 views
how to trap a suspend a resume from a bash script
I have a bash script (on osx) running continuously, it currently traps and handles a terminate like so
trap onshutdown TERM
how can I make trap also handle suspend/resume like
trap onsuspend ?
...