File: complex-proc.sh

package info (click to toggle)
wvstreams 4.6.1-19
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 7,420 kB
  • sloc: cpp: 64,196; ansic: 4,154; sh: 4,025; makefile: 546; perl: 402
file content (30 lines) | stat: -rwxr-xr-x 535 bytes parent folder | download | duplicates (11)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#!/bin/bash
# A program that generates some subprograms.  For testing WvSubProc.
MAIN="$1-pid$$"

go()
{
	SUB="$1"
	
	trap "echo Exiting $SUB on TERM...; exit 0" SIGTERM
	trap "echo Exiting $SUB on INT...; exit 0" SIGINT

	for a in 1 2 3 4 5 6 7 8 9 10; do
		echo "   $SUB.$a"
		sleep 1
	done
	
	echo "Done $SUB."
}

trap "echo Exiting $MAIN on TERM...; exit 0" SIGTERM
trap "echo Exiting $MAIN on INT...; exit 0" SIGINT

for d in 1 2 3 4 5 6 7 8 9 10; do
	echo "Starting $MAIN.$d..."
	go $MAIN.$d &
	sleep 3
done

echo "Done $MAIN."