abort1
author A.M. Thurnherr <ant@ldeo.columbia.edu>
Wed, 07 Jul 2010 13:29:02 -0400
changeset 3 99a41e0476b1
parent 0 648bde652211
child 4 fda11de1826e
permissions -rwxr-xr-x
.

#!/usr/bin/expect -f
#======================================================================
#                    A B O R T 1 
#                    doc: Wed Mar 10 22:23:52 2004
#                    dlm: Wed Nov 19 15:10:44 2008
#                    (c) 2004 A.M. Thurnherr
#                    uE-Info: 13 32 NIL 0 0 72 2 2 8 NIL ofnI
#======================================================================

# HISTORY:
#  Jun 19, 2004: - adapted from [endladcp1]
#  Nov  6, 2006: - adapted to old regsub
#  Nov 19, 2008: - added version

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

log_user 0;
source DEFAULTS.expect;
regsub {dir1} [exec which dir1] {libBB.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;

set_color;
send_user "Connecting to instrument...";
wait_for_startup;
reset_instrument;

send_user "\nGetting station number...";
set deployment_name [get_deployment_name];
if {[scan $deployment_name $master_deployment_name_fmt stn] != 1} {
	send_error "$deployment_name $master_deployment_name_fmt";
	error "Can't get station number";
}
set stnstr [format $stn_format $stn];
send_user "\[$stnstr\]";

send_user "\nPutting instrument to sleep...";
put_to_sleep;

set cast_dir [format %s/%s $raw_dir $stnstr];
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"