comparison stdio_catcher @ 18:e0a1f92fcbc9

FIX: locking up due to multithreaded access during garbage collection.
author samer
date Mon, 06 Feb 2012 14:25:05 +0000
parents
children
comparison
equal deleted inserted replaced
17:084a1e7377a7 18:e0a1f92fcbc9
1 #!/bin/sh
2 echo "In stdio_catcher"
3
4 function handle_term {
5 echo "### $(date): received SIGTERM" >> "$outputlog"
6 exit
7 }
8
9 function handle_int {
10 echo "### $(date): received SIGINT" >> "$outputlog"
11 }
12
13 function handle_hup {
14 echo "### $(date): received SIGHUP" >> "$outputlog"
15 exit
16 }
17
18 trap handle_int 2
19 trap handle_term 15
20 trap handle_hup 1
21
22 inputlog="$1"
23 outputlog="$2"
24 shift 2
25
26 echo "### $(date): INPUT - $@" >> "$inputlog"
27 echo "### $(date): OUTPUT - $@" >> "$outputlog"
28 nohup tee -a "$inputlog" | "$@" | nohup tee -a "$outputlog"
29 #"$@"