abort2
author A.M. Thurnherr <athurnherr@yahoo.com>
Fri, 03 Jul 2020 10:25:08 -0400
changeset 12 5e67754f6457
parent 4 fda11de1826e
permissions -rwxr-xr-x
V1.6: no more master/slave terminology

#!/usr/bin/expect -f
#======================================================================
#                    A B O R T 2 
#                    doc: Wed Mar 10 22:23:52 2004
#                    dlm: Fri Jul  3 10:11:27 2020
#                    (c) 2004 A.M. Thurnherr
#                    uE-Info: 57 20 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
#  Jul  3, 2020: - expunged master/slave terminology

#----------------------------------------------------------------------
# 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_DL 0;
set DL_deployment_name [get_deployment_name];
if {[scan $DL_deployment_name $DL_deployment_name_fmt DL_stn] != 1} {
	send_error "$DL_deployment_name $DL_deployment_name_fmt";
	error "Can't get station number of DL";
}
select_UL; set UL_deployment_name [get_deployment_name];
set UL_deployment_name [get_deployment_name];
if {[scan $UL_deployment_name $UL_deployment_name_fmt UL_stn] != 1} {
	error "Can't get station number of UL";
}
if {$DL_stn != $UL_stn} {
	select_DL; put_to_sleep; select_UL; put_to_sleep;
	error "DL/UL stations disagree";
}
set stn [format $stn_format $DL_stn];
send_user "\[$stn\]";

send_user "\nPutting instruments to sleep..."
select_DL; put_to_sleep; select_UL; 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"