source: trunk/packages/vizservers/nanoscale/monitor.tcl @ 1018

Last change on this file since 1018 was 467, checked in by mmc, 15 years ago

Last minute fixes so we can deploy the nanoVIS server:

  • Added monitor.tcl script which monitors nanoscale and restarts as needed.
  • Fixed relative paths for shaders and fonts. All shaders and fonts are

taken from /opt/nanovis/lib

  • Fixed the ordering of data for the nanowire simulator
File size: 1.4 KB
Line 
1# ----------------------------------------------------------------------
2#  MONITOR
3#
4#  This script checks to see if the nanoscale server is alive, and
5#  if not, it attempts to execute another one.  It is run every so
6#  often to make sure that the system is up and running.
7# ======================================================================
8#  AUTHOR:  Michael McLennan, Purdue University
9#  Copyright (c) 2004-2006  Purdue Research Foundation
10#
11#  See the file "license.terms" for information on usage and
12#  redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES.
13# ======================================================================
14
15# This is where the production nanoscale server should be running
16set port 4000
17
18proc email {to subject body} {
19    set message "To: $to"
20    append message "\nFrom: support@nanohub.org"
21    append message "\nSubject: $subject"
22    append message "\n\n"  ;# sendmail terminates header with blank line
23    append message "$body"
24   
25    catch {
26        set fid [open "| /usr/lib/sendmail -oi -t" "w"]
27        puts -nonewline $fid $message
28        close $fid
29    }
30}
31
32if {[catch {socket localhost $port}]} {
33    if {[catch {exec /bin/sh /opt/nanovis/bin/start_server &} err]} {
34        email mmc@tmail.com "nanoVIS problem" "Can't launch server on [info hostname]:\n$err"
35    } else {
36        email mmc@tmail.com "nanoVIS restarted" "Relaunched server on [info hostname] at [clock format [clock seconds]]"
37    }
38}
Note: See TracBrowser for help on using the repository browser.