[Discuss] To bash experts here....
Andrew M. B. Boktor
andrew.botros at gmail.com
Sat Jul 18 18:38:30 PDT 2015
Here's an example that I've tested on my machine, pretty easy to do
cat script.sh
#!/bin/bash
myexit () {
echo "Exiting my way"
exit 0
}
trap myexit INT
while true; do
echo alive
sleep 1
done
On Fri, Jul 17, 2015 at 1:04 PM, Alan W. Irwin <irwin at beluga.phys.uvic.ca>
wrote:
> On 2015-07-17 12:55-0700 Alan W. Irwin wrote:
>
> For PLplot I have implemented a fairly complex bash script that runs
>> through a large series of tasks to do comprehensive testing of PLplot.
>> The script calls its own special exit function whenever the script logic
>> says
>> it is time to exit, and that function among other tasks collects a
>> convenient report tarball of carefully selected test results which makes
>> it much easier for me to diagnose any PLplot problems that occur
>> during the comprehensive testing.
>>
>> So far so good, but sometimes this script just hangs (e.g., on
>> platforms which have buggy parallel builds such as MSYS and MSYS2) so
>> the user has to interrupt it to get it to exit. Can bash logic
>> intercept such user interruptions and force exiting via the special
>> exit function?
>>
>> One PLplot tester has just run into this problem so he has attempted
>> to compensate by collecting all the useful bits and pieces by hand in
>> a tarball. But the results would be more reliable and also more
>> convenient for him, if the script could automatically do that when it
>> was interrupted.
>>
>
> Never mind. I haven't tried it yet, but there is a straightforward
> example of bash interrupt handling at
> <http://kb.mit.edu/confluence/pages/viewpage.action?pageId=3907156>
> which assuming it works should solve the above issue.
>
> Alan
>
>
>
>
>
>> Alan
>> __________________________
>> Alan W. Irwin
>>
>> Astronomical research affiliation with Department of Physics and
>> Astronomy,
>> University of Victoria (astrowww.phys.uvic.ca).
>>
>> Programming affiliations with the FreeEOS equation-of-state
>> implementation for stellar interiors (freeeos.sf.net); the Time
>> Ephemerides project (timeephem.sf.net); PLplot scientific plotting
>> software package (plplot.sf.net); the libLASi project
>> (unifont.org/lasi); the Loads of Linux Links project (loll.sf.net);
>> and the Linux Brochure Project (lbproject.sf.net).
>> __________________________
>>
>> Linux-powered Science
>> __________________________
>> _______________________________________________
>> Discuss mailing list
>> Discuss at vlug.org
>> http://lists.vlug.org/mailman/listinfo/discuss
>>
>>
> __________________________
> Alan W. Irwin
>
> Astronomical research affiliation with Department of Physics and Astronomy,
> University of Victoria (astrowww.phys.uvic.ca).
>
> Programming affiliations with the FreeEOS equation-of-state
> implementation for stellar interiors (freeeos.sf.net); the Time
> Ephemerides project (timeephem.sf.net); PLplot scientific plotting
> software package (plplot.sf.net); the libLASi project
> (unifont.org/lasi); the Loads of Linux Links project (loll.sf.net);
> and the Linux Brochure Project (lbproject.sf.net).
> __________________________
>
> Linux-powered Science
> __________________________
> _______________________________________________
> Discuss mailing list
> Discuss at vlug.org
> http://lists.vlug.org/mailman/listinfo/discuss
>
--
Andrew Boktor
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://vlug.org/pipermail/discuss_vlug.org/attachments/20150718/349b717d/attachment.html>
More information about the Discuss
mailing list