~ubuntu-branches/ubuntu/precise/scilab/precise

« back to all changes in this revision

Viewing changes to debian/watcher.sh

  • Committer: Bazaar Package Importer
  • Author(s): Sylvestre Ledru
  • Date: 2010-03-08 15:58:54 UTC
  • mfrom: (4.3.12 sid)
  • Revision ID: james.westby@ubuntu.com-20100308155854-uro4dduv1g786l4l
Tags: 5.2.1-5
scilab-include is now arch dependent because machine.h is arch dependent
and is included by some Scilab modules and causes some potential issues 
like in scilab-overload (Closes: #550243)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/bin/sh
 
2
 
 
3
if [ "$#" -ne 4 ]
 
4
then
 
5
    echo "Watcher: Bad args: $#"
 
6
    exit 1
 
7
fi
 
8
 
 
9
CHECK_PID=$1
 
10
DIR="$2"
 
11
FILE="$3"
 
12
GREP_FOR="$4"
 
13
 
 
14
echo "Watcher: Check PID: $CHECK_PID"
 
15
echo "Watcher: Directory: $DIR"
 
16
echo "Watcher: File: $FILE"
 
17
echo "Watcher: Grep for: $GREP_FOR"
 
18
 
 
19
if [ -d "$DIR" ]; then
 
20
    if [ -f "$DIR/watcher-lock" ]; then
 
21
        echo "Watcher: not spawning as lock in place"
 
22
        exit 1
 
23
    else
 
24
        echo "Watcher: creating lock"
 
25
        touch $DIR/watcher-lock
 
26
    fi
 
27
fi
 
28
 
 
29
# If the PID we are told still exists (our caller is still running),
 
30
# the directory we are told (the working directory still exists) and
 
31
# the file we are told doesn't exist (the build stamp hasn't been created)
 
32
# keep going
 
33
while ps "$CHECK_PID" > /dev/null &&
 
34
      [ -d "$DIR" ] &&
 
35
      [ ! -f "$FILE" ]
 
36
do
 
37
    sleep 600
 
38
    echo "Watcher: Tick."
 
39
    ps ux | grep -- "$GREP_FOR" | grep -v grep
 
40
done
 
41
 
 
42
echo "Watcher: Terminating."
 
43
echo "Watcher: Removing lock"
 
44
[ -f $DIR/watcher-lock ] && rm $DIR/watcher-lock
 
 
b'\\ No newline at end of file'