1 | #! /bin/sh |
---|
2 | |
---|
3 | DISPLAY=:0 |
---|
4 | export DISPLAY |
---|
5 | |
---|
6 | # Fail on errors |
---|
7 | set -e |
---|
8 | |
---|
9 | # Use the IP address of this host to construct a broadcast address. This |
---|
10 | # feature will be hopefully going away very soon. |
---|
11 | |
---|
12 | broadcast=`hostname -i | sed 's/\.[0-9]* $/.255/'` |
---|
13 | |
---|
14 | render_dir="@prefix@" |
---|
15 | nanoscale_port=2000 |
---|
16 | nanovis_port=2000 |
---|
17 | pymol_port=2020 |
---|
18 | |
---|
19 | # Build the name of the run directory. This is where nanoscale and the |
---|
20 | # visualization programs will reside. The directory name is the same as the |
---|
21 | # render directory. |
---|
22 | dir="/tmp/`basename $render_dir`" |
---|
23 | |
---|
24 | |
---|
25 | PATH=${dir}/bin:$PATH |
---|
26 | LD_LIBRARY_PATH=${dir}/lib:$LD_LIBRARY_PATH |
---|
27 | PYMOL_PATH=${dir}/lib/pymol |
---|
28 | |
---|
29 | export PATH LD_LIBRARY_PATH PYMOL_PATH |
---|
30 | |
---|
31 | # Determine the number of video cards we have. The new render server |
---|
32 | # motherboards have the useless XGI Volaria onboard video controllers (no 3D |
---|
33 | # capabilities) so we have to make sure we count only the nVidia cards. |
---|
34 | |
---|
35 | nvideo=`lspci | fgrep VGA | fgrep nVidia | wc -l` |
---|
36 | |
---|
37 | nanoscale="${dir}/bin/nanoscale -x ${nvideo} -b $nanoscale_port -s $broadcast" |
---|
38 | nanovis="${dir}/bin/nanovis -p ${dir}/lib/shaders:${dir}/lib/resources" |
---|
39 | pymolproxy="${dir}/bin/pymolproxy ${dir}/bin/pymol -p -q -i -x -X 0 -Y 0" |
---|
40 | |
---|
41 | # Copy from render directory if the run copy doesn't already exist. |
---|
42 | # Otherwise use what's there. This means that successive invocations |
---|
43 | # of nanoscale won't create their own run directories (only the first |
---|
44 | # one will). |
---|
45 | |
---|
46 | if test -d "$dir" ; then |
---|
47 | echo "Reusing previously installed version from $render_dir" |
---|
48 | else |
---|
49 | echo "Copying rappture from $render_dir" |
---|
50 | mkdir -p $dir |
---|
51 | tar -C ${render_dir} -clf - . | tar -C $dir -xpf - |
---|
52 | fi |
---|
53 | |
---|
54 | cd ${dir} |
---|
55 | |
---|
56 | # Don't let nanoscale and the visualization servers run away. |
---|
57 | # Limit cpu time to 20 minutes. |
---|
58 | minutes=20 |
---|
59 | ulimit -t $(expr ${minutes} \* 60 ) |
---|
60 | |
---|
61 | echo "$nanoscale -l $nanovis_port -c \"$nanovis\" -l $pymol_port -c \"$pymolproxy\"" |
---|
62 | $nanoscale -l $nanovis_port -c "$nanovis" -l $pymol_port -c "$pymolproxy" |
---|
63 | |
---|