0
|
1 |
#!/usr/bin/expect -f
|
|
2 |
#======================================================================
|
|
3 |
# A B O R T 1
|
|
4 |
# doc: Wed Mar 10 22:23:52 2004
|
|
5 |
# dlm: Wed Nov 19 15:10:44 2008
|
|
6 |
# (c) 2004 A.M. Thurnherr
|
|
7 |
# uE-Info: 13 32 NIL 0 0 72 2 2 8 NIL ofnI
|
|
8 |
#======================================================================
|
|
9 |
|
|
10 |
# HISTORY:
|
|
11 |
# Jun 19, 2004: - adapted from [endladcp1]
|
|
12 |
# Nov 6, 2006: - adapted to old regsub
|
|
13 |
# Nov 19, 2008: - added version
|
|
14 |
|
|
15 |
#----------------------------------------------------------------------
|
|
16 |
# Setup
|
|
17 |
#----------------------------------------------------------------------
|
|
18 |
|
|
19 |
log_user 0;
|
|
20 |
source DEFAULTS.expect;
|
|
21 |
regsub {dir1} [exec which dir1] {libBB.expect} path;
|
|
22 |
source $path;
|
|
23 |
|
|
24 |
print_version;
|
|
25 |
|
|
26 |
if ![file isdirectory $raw_dir] {
|
|
27 |
error "directory $raw_dir does not exist";
|
|
28 |
}
|
|
29 |
|
|
30 |
#----------------------------------------------------------------------
|
|
31 |
# Get Station Number
|
|
32 |
#----------------------------------------------------------------------
|
|
33 |
|
|
34 |
spawn bbabble -ms $tty0;
|
|
35 |
|
|
36 |
set_color;
|
|
37 |
send_user "Connecting to instrument...";
|
|
38 |
wait_for_startup;
|
|
39 |
reset_instrument;
|
|
40 |
|
|
41 |
send_user "\nGetting station number...";
|
|
42 |
set deployment_name [get_deployment_name];
|
|
43 |
if {[scan $deployment_name $master_deployment_name_fmt stn] != 1} {
|
|
44 |
send_error "$deployment_name $master_deployment_name_fmt";
|
|
45 |
error "Can't get station number";
|
|
46 |
}
|
|
47 |
set stnstr [format $stn_format $stn];
|
|
48 |
send_user "\[$stnstr\]";
|
|
49 |
|
|
50 |
send_user "\nPutting instrument to sleep...";
|
|
51 |
put_to_sleep;
|
|
52 |
|
|
53 |
set cast_dir [format %s/%s $raw_dir $stnstr];
|
|
54 |
if {![file isdirectory $cast_dir]} {
|
|
55 |
error "\ncast directory $cast_dir does not exist!";
|
|
56 |
}
|
|
57 |
|
|
58 |
send_user "\nRenaming $cast_dir..."
|
|
59 |
set attempt 1; # rename
|
|
60 |
while {[file isdirectory $cast_dir.aborted$attempt]} {
|
|
61 |
set attempt [expr $attempt + 1];
|
|
62 |
}
|
|
63 |
exec mv $cast_dir $cast_dir.aborted$attempt;
|
|
64 |
|
|
65 |
send_user "\nDone\n"
|