abort2
author A.M. Thurnherr <ant@ldeo.columbia.edu>
Tue, 14 Sep 2010 13:34:39 -0400
changeset 4 fda11de1826e
parent 0 648bde652211
child 12 5e67754f6457
permissions -rwxr-xr-x
version left on Poseidon at end of P403

#!/usr/bin/expect -f
#======================================================================
#                    A B O R T 2 
#                    doc: Wed Mar 10 22:23:52 2004
#                    dlm: Thu Aug 26 00:25:52 2010
#                    (c) 2004 A.M. Thurnherr
#                    uE-Info: 22 39 NIL 0 0 72 2 2 8 NIL ofnI
#======================================================================

# HISTORY:
#  Jun 19, 2004: - adapted from [endladcp2]
#  Nov 19, 2008: - added version
#  Aug 25, 2010: - DEFAULTS.expect -> CRUISE_SETUP.expect
#		 - libBB.expect -> libRDI.expect

#----------------------------------------------------------------------
# Setup
#----------------------------------------------------------------------

log_user 0;
source CRUISE_SETUP.expect;
regsub {dir1} [exec which dir1] {libRDI.expect} path;
source $path;

print_version;

if ![file isdirectory $raw_dir] {
	error "directory $raw_dir does not exist";
}

#----------------------------------------------------------------------
# Get Station Number
#----------------------------------------------------------------------

spawn bbabble -ms $tty0 $tty1;

set_color;
send_user "Connecting to instruments...";
wait_for_startup;
reset_two_instruments;

send_user "\nGetting station number...";
select_master 0;
set master_deployment_name [get_deployment_name];
if {[scan $master_deployment_name $master_deployment_name_fmt master_stn] != 1} {
	send_error "$master_deployment_name $master_deployment_name_fmt";
	error "Can't get station number of master";
}
select_slave; set slave_deployment_name [get_deployment_name];
set slave_deployment_name [get_deployment_name];
if {[scan $slave_deployment_name $slave_deployment_name_fmt slave_stn] != 1} {
	error "Can't get station number of slave";
}
if {$master_stn != $slave_stn} {
	select_master; put_to_sleep; select_slave; put_to_sleep;
	error "Master/slave stations disagree";
}
set stn [format $stn_format $master_stn];
send_user "\[$stn\]";

send_user "\nPutting instruments to sleep..."
select_master; put_to_sleep; select_slave; put_to_sleep;

set cast_dir [format %s/%s $raw_dir $stn];
if {![file isdirectory $cast_dir]} {
	error "\ncast directory $cast_dir does not exist!";
}

send_user "\nRenaming $cast_dir..."
set attempt 1;					# rename
while {[file isdirectory $cast_dir.aborted$attempt]} {
	set attempt [expr $attempt + 1];
}
exec mv $cast_dir $cast_dir.aborted$attempt;

send_user "\nDone\n"