checkfiles2
changeset 12 5e67754f6457
parent 4 fda11de1826e
equal deleted inserted replaced
11:c39e37d59638 12:5e67754f6457
     1 #!/usr/bin/expect -f
     1 #!/usr/bin/expect -f
     2 #======================================================================
     2 #======================================================================
     3 #                    C H E C K F I L E S 2 
     3 #                    C H E C K F I L E S 2 
     4 #                    doc: Wed Mar 10 22:23:52 2004
     4 #                    doc: Wed Mar 10 22:23:52 2004
     5 #                    dlm: Thu Aug 26 00:26:06 2010
     5 #                    dlm: Fri Jul  3 10:14:00 2020
     6 #                    (c) 2004 A.M. Thurnherr
     6 #                    (c) 2004 A.M. Thurnherr
     7 #                    uE-Info: 27 39 NIL 0 0 72 2 2 8 NIL ofnI
     7 #                    uE-Info: 90 18 NIL 0 0 72 2 2 8 NIL ofnI
     8 #======================================================================
     8 #======================================================================
     9 
     9 
    10 # HISTORY:
    10 # HISTORY:
    11 #  Jun 16, 2004: - copied from [endladcp2] to allow continuation after
    11 #  Jun 16, 2004: - copied from [endladcp2] to allow continuation after
    12 #		   download ok
    12 #		   download ok
    15 #  Oct 28, 2006: - adapted to old version expect (regsub)
    15 #  Oct 28, 2006: - adapted to old version expect (regsub)
    16 #		 - allowed for lrb downcasing filenames
    16 #		 - allowed for lrb downcasing filenames
    17 #  Nov 19, 2008: - added version
    17 #  Nov 19, 2008: - added version
    18 #  Aug 25, 2010: - DEFAULTS.expect -> CRUISE_SETUP.expect
    18 #  Aug 25, 2010: - DEFAULTS.expect -> CRUISE_SETUP.expect
    19 #		 - libBB.expect -> libRDI.expect
    19 #		 - libBB.expect -> libRDI.expect
       
    20 #  Jul  3, 2020: - expunged master/slave terminology
    20 
    21 
    21 #----------------------------------------------------------------------
    22 #----------------------------------------------------------------------
    22 # Setup
    23 # Setup
    23 #----------------------------------------------------------------------
    24 #----------------------------------------------------------------------
    24 
    25 
    43 send_user "Connecting to instruments...";
    44 send_user "Connecting to instruments...";
    44 wait_for_startup;
    45 wait_for_startup;
    45 reset_two_instruments;
    46 reset_two_instruments;
    46 
    47 
    47 send_user "\nGetting station number...";
    48 send_user "\nGetting station number...";
    48 select_master 0;
    49 select_DL 0;
    49 set master_deployment_name [get_deployment_name];
    50 set DL_deployment_name [get_deployment_name];
    50 if {[scan $master_deployment_name $master_deployment_name_fmt master_stn] != 1} {
    51 if {[scan $DL_deployment_name $DL_deployment_name_fmt DL_stn] != 1} {
    51 	send_error "$master_deployment_name $master_deployment_name_fmt";
    52 	send_error "$DL_deployment_name $DL_deployment_name_fmt";
    52 	error "Can't get station number of master";
    53 	error "Can't get station number of DL";
    53 }
    54 }
    54 select_slave; set slave_deployment_name [get_deployment_name];
    55 select_UL; set UL_deployment_name [get_deployment_name];
    55 set slave_deployment_name [get_deployment_name];
    56 set UL_deployment_name [get_deployment_name];
    56 if {[scan $slave_deployment_name $slave_deployment_name_fmt slave_stn] != 1} {
    57 if {[scan $UL_deployment_name $UL_deployment_name_fmt UL_stn] != 1} {
    57 	error "Can't get station number of slave";
    58 	error "Can't get station number of UL";
    58 }
    59 }
    59 if {$master_stn != $slave_stn} {
    60 if {$DL_stn != $UL_stn} {
    60 	select_master; put_to_sleep; select_slave; put_to_sleep;
    61 	select_DL; put_to_sleep; select_UL; put_to_sleep;
    61 	error "Master/slave stations disagree";
    62 	error "DL/UL stations disagree";
    62 }
    63 }
    63 set stn [format $stn_format $master_stn];
    64 set stn [format $stn_format $DL_stn];
    64 send_user "\[$stn\]";
    65 send_user "\[$stn\]";
    65 
    66 
    66 set cast_dir [format %s/%s $raw_dir $stn];
    67 set cast_dir [format %s/%s $raw_dir $stn];
    67 if {![file isdirectory $cast_dir]} {
    68 if {![file isdirectory $cast_dir]} {
    68 	select_master; put_to_sleep; select_slave; put_to_sleep;
    69 	select_DL; put_to_sleep; select_UL; put_to_sleep;
    69 	error "cast directory $cast_dir does not exist!";
    70 	error "cast directory $cast_dir does not exist!";
    70 }
    71 }
    71 
    72 
    72 cd $cast_dir;
    73 cd $cast_dir;
    73 send \004;
    74 send \004;
    78 
    79 
    79 regsub {.*/} $argv0 {} tmp;
    80 regsub {.*/} $argv0 {} tmp;
    80 start_logging [format %s_%s.log $tmp $stn];
    81 start_logging [format %s_%s.log $tmp $stn];
    81 
    82 
    82 send_user "\nChecking data files...\n";
    83 send_user "\nChecking data files...\n";
    83 set_color 0; check_data [format %s000.000 [format $master_deployment_name_fmt $master_stn]];
    84 set_color 0; check_data [format %s000.000 [format $DL_deployment_name_fmt $DL_stn]];
    84 set_color 1; check_data [format %s000.000 [format $slave_deployment_name_fmt $slave_stn]];
    85 set_color 1; check_data [format %s000.000 [format $UL_deployment_name_fmt $UL_stn]];
    85 set_color;
    86 set_color;
    86 
    87 
    87 send_user "Backing up data files...";
    88 send_user "Backing up data files...";
    88 backup_master_data $master_stn;
    89 backup_DL_data $DL_stn;
    89 backup_slave_data $slave_stn;
    90 backup_UL_data $UL_stn;
    90 
    91 
    91 send_user "\nDone\n"
    92 send_user "\nDone\n"
    92 
    93