0
|
1 |
#!/usr/bin/expect -f
|
|
2 |
#======================================================================
|
|
3 |
# C H E C K F I L E S 1
|
|
4 |
# doc: Wed Mar 10 22:23:52 2004
|
|
5 |
# dlm: Wed Nov 19 15:11:21 2008
|
|
6 |
# (c) 2004 A.M. Thurnherr
|
|
7 |
# uE-Info: 27 14 NIL 0 0 72 2 2 8 NIL ofnI
|
|
8 |
#======================================================================
|
|
9 |
|
|
10 |
# HISTORY:
|
|
11 |
# Jun 27, 2004: - adapted from [endladcp1] to allow continuation after
|
|
12 |
# download ok
|
|
13 |
# Feb 14, 2006: - BUG: no logging was done
|
|
14 |
# Oct 4, 2006: - adapted to older expect version
|
|
15 |
# Oct 28, 2006: - adapted to older expect version
|
|
16 |
# Nov 19, 2008: - added version
|
|
17 |
|
|
18 |
#----------------------------------------------------------------------
|
|
19 |
# Setup
|
|
20 |
#----------------------------------------------------------------------
|
|
21 |
|
|
22 |
log_user 0;
|
|
23 |
source DEFAULTS.expect;
|
|
24 |
regsub {dir1} [exec which dir1] {libBB.expect} path;
|
|
25 |
source $path;
|
|
26 |
|
|
27 |
print_version;
|
|
28 |
|
|
29 |
if ![file isdirectory $raw_dir] {
|
|
30 |
error "directory $raw_dir does not exist";
|
|
31 |
}
|
|
32 |
|
|
33 |
#----------------------------------------------------------------------
|
|
34 |
# Get Station Number
|
|
35 |
#----------------------------------------------------------------------
|
|
36 |
|
|
37 |
spawn bbabble -ms $tty0;
|
|
38 |
|
|
39 |
set_color;
|
|
40 |
send_user "Connecting to instrument...";
|
|
41 |
wait_for_startup;
|
|
42 |
reset_instrument;
|
|
43 |
|
|
44 |
send_user "\nGetting station number...";
|
|
45 |
set deployment_name [get_deployment_name];
|
|
46 |
if {[scan $deployment_name $master_deployment_name_fmt stn] != 1} {
|
|
47 |
send_error "$deployment_name $master_deployment_name_fmt";
|
|
48 |
error "Can't get station number";
|
|
49 |
}
|
|
50 |
set stnstr [format $stn_format $stn];
|
|
51 |
send_user "\[$stnstr\]";
|
|
52 |
|
|
53 |
set cast_dir [format %s/%s $raw_dir $stnstr];
|
|
54 |
if {![file isdirectory $cast_dir]} {
|
|
55 |
put_to_sleep;
|
|
56 |
error "cast directory $cast_dir does not exist!";
|
|
57 |
}
|
|
58 |
|
|
59 |
cd $cast_dir;
|
|
60 |
send \004;
|
|
61 |
|
|
62 |
#----------------------------------------------------------------------
|
|
63 |
# Check & Backup Data
|
|
64 |
#----------------------------------------------------------------------
|
|
65 |
|
|
66 |
regsub {.*/} $argv0 {} basename;
|
|
67 |
start_logging [format %s_%s.log $basename $stnstr];
|
|
68 |
|
|
69 |
send_user "\nChecking data file...\n";
|
|
70 |
set_color 0;
|
|
71 |
check_data [format %s000.000 [format $master_deployment_name_fmt $stn]];
|
|
72 |
set_color;
|
|
73 |
|
|
74 |
send_user "Backing up data file...";
|
|
75 |
backup_master_data $stn;
|
|
76 |
|
|
77 |
send_user "\nDone\n"
|