diff --git a/.gitignore b/.gitignore index 37795d614..c1d8089f9 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,6 @@ # Copied from github/gitignore/C.gitignore # Prerequisites +*.gitignore *.d # Object files @@ -73,3 +74,5 @@ third_party/lib/ .fs_version .DS_Store +.vs + diff --git a/Makefile b/Makefile index 067c99ca3..64f1506b7 100644 --- a/Makefile +++ b/Makefile @@ -4,20 +4,20 @@ FS_DIRECTORY := $(shell echo $(pwd) | rev | cut -d/ -f1 | rev ) #look for git first FS_COMMIT := $(shell git describe --always --tags 2>/dev/null) ifneq ($(FS_COMMIT),) -#for old git, 1.5.6.5 in FSL8 anyway, --dirty isn't supported by -# git describe, so we do a git diff HEAD instead (for all versions) -# further, in 1.5.6.5, git diff HEAD --quiet thinks there is a change -# after root does a make install, redirecting output has the opposite -# problem, no changes are detected, but doing a git status first -# seems to clean it up and seems benign for other versions -FS_VERSION := $(shell git status 2>&1 >/dev/null) -FS_VERSION := $(FS_COMMIT)$(shell git diff HEAD --quiet || echo "-dirty") + #for old git, 1.5.6.5 in FSL8 anyway, --dirty isn't supported by + # git describe, so we do a git diff HEAD instead (for all versions) + # further, in 1.5.6.5, git diff HEAD --quiet thinks there is a change + # after root does a make install, redirecting output has the opposite + # problem, no changes are detected, but doing a git status first + # seems to clean it up and seems benign for other versions + FS_VERSION := $(shell git status 2>&1 >/dev/null) + FS_VERSION := $(FS_COMMIT)$(shell git diff HEAD --quiet || echo "-dirty") else -#alternatively, an archive version -# there should be no other dashes except in the basename: -# fs-VERSION.SUBLEVEL.PATCHLEVEL-RELEASE -# -RELEASE is optional -FS_VERSION := $(shell echo $(pwd) | cut -d- -f2-) + #alternatively, an archive version + # there should be no other dashes except in the basename: + # fs-VERSION.SUBLEVEL.PATCHLEVEL-RELEASE + # -RELEASE is optional + FS_VERSION := $(shell echo $(pwd) | cut -d- -f2-) endif # VERSION := $(shell echo $(FS_VERSION) | cut -d. -f1 -s ) @@ -25,14 +25,47 @@ SUBLEVEL := $(shell echo $(FS_VERSION) | cut -d. -f2 -s ) PATCHLEVEL := $(shell echo $(FS_VERSION) | cut -d. -f3 -s | cut -d- -f1) RELEASE := $(shell echo $(FS_VERSION) | cut -d- -f2- -s) -ifeq ($(VERSION),) -$(error no VERSION value) -endif -ifeq ($(SUBLEVEL),) -$(error no SUBLEVEL value) -endif -ifeq ($(PATCHLEVEL),) -$(error no PATCHLEVEL value) +ifeq (root,$(shell whoami)) + ifneq (install,$(MAKECMDGOALS)) + $(error root can only use 'make install') + endif + ifeq ($(wildcard $(pwd)/.git),) + ifeq ($(VERSION),) + $(info Directory '$(pwd)' from archive has no VERSION value in name.) + $(error Please fix) + endif + ifeq ($(SUBLEVEL),) + $(info Directory '$(pwd)' from archive has no SUBLEVEL value in name.) + $(error Please fix) + endif + ifeq ($(PATCHLEVEL),) + $(info Directory '$(pwd)' from archive has no PATCHLEVEL value in name.) + $(error Please fix) + endif + endif +# +else + ifeq (install,$(findstring install,$(MAKECMDGOALS))) + $(error only root can use 'make install') + endif + ifeq ($(VERSION),) + ifeq ($(wildcard $(pwd)/.git),) + $(info Improperly installed archive, the directory name is ill-formed.) + endif + $(error no VERSION value) + endif + ifeq ($(SUBLEVEL),) + ifeq ($(wildcard $(pwd)/.git),) + $(info Improperly installed archive, the directory name is ill-formed.) + endif + $(error no SUBLEVEL value) + endif + ifeq ($(PATCHLEVEL),) + ifeq ($(wildcard $(pwd)/.git),) + $(info Improperly installed archive, the directory name is ill-formed.) + endif + $(error no PATCHLEVEL value) + endif endif export VERSION SUBLEVEL PATCHLEVEL FS_VERSION RELEASE FS_DIRECTORY # print variable, use 'make print-VERSION' to print VERSION diff --git a/aquir/kgetc.f b/aquir/kgetc.f index 0471b306c..38238a414 100644 --- a/aquir/kgetc.f +++ b/aquir/kgetc.f @@ -1,5 +1,5 @@ * -* Copyright (c) 2020 NVI, Inc. +* Copyright (c) 2020, 2023 NVI, Inc. * * This file is part of VLBI Field System * (see http://github.com/nvi-inc/fs). diff --git a/boss/binit.f b/boss/binit.f index ff7b22455..414b36124 100644 --- a/boss/binit.f +++ b/boss/binit.f @@ -1,5 +1,5 @@ * -* Copyright (c) 2020 NVI, Inc. +* Copyright (c) 2020, 2023 NVI, Inc. * * This file is part of VLBI Field System * (see http://github.com/nvi-inc/fs). diff --git a/boss/getcm.f b/boss/getcm.f index c04f8bfe2..c91299a5c 100644 --- a/boss/getcm.f +++ b/boss/getcm.f @@ -1,5 +1,5 @@ * -* Copyright (c) 2020 NVI, Inc. +* Copyright (c) 2020, 2023 NVI, Inc. * * This file is part of VLBI Field System * (see http://github.com/nvi-inc/fs). diff --git a/boss/ldrivem.f b/boss/ldrivem.f index a13d735ad..4c10e94cd 100644 --- a/boss/ldrivem.f +++ b/boss/ldrivem.f @@ -1,5 +1,5 @@ * -* Copyright (c) 2020 NVI, Inc. +* Copyright (c) 2020, 2023 NVI, Inc. * * This file is part of VLBI Field System * (see http://github.com/nvi-inc/fs). diff --git a/boss/ldrivev.f b/boss/ldrivev.f index 723d951dd..334defb4b 100644 --- a/boss/ldrivev.f +++ b/boss/ldrivev.f @@ -1,5 +1,5 @@ * -* Copyright (c) 2020 NVI, Inc. +* Copyright (c) 2020, 2023 NVI, Inc. * * This file is part of VLBI Field System * (see http://github.com/nvi-inc/fs). diff --git a/boss/lhead.f b/boss/lhead.f index 5872a7e8d..ee0ba9ebe 100644 --- a/boss/lhead.f +++ b/boss/lhead.f @@ -1,5 +1,5 @@ * -* Copyright (c) 2020 NVI, Inc. +* Copyright (c) 2020, 2023 NVI, Inc. * * This file is part of VLBI Field System * (see http://github.com/nvi-inc/fs). diff --git a/boss/newpf.f b/boss/newpf.f index e0db3457a..7bad3d87d 100644 --- a/boss/newpf.f +++ b/boss/newpf.f @@ -1,5 +1,5 @@ * -* Copyright (c) 2020 NVI, Inc. +* Copyright (c) 2020, 2023 NVI, Inc. * * This file is part of VLBI Field System * (see http://github.com/nvi-inc/fs). diff --git a/boss/newpr.f b/boss/newpr.f index 9d2fb642f..914613680 100644 --- a/boss/newpr.f +++ b/boss/newpr.f @@ -1,5 +1,5 @@ * -* Copyright (c) 2020 NVI, Inc. +* Copyright (c) 2020, 2023 NVI, Inc. * * This file is part of VLBI Field System * (see http://github.com/nvi-inc/fs). diff --git a/boss/newsk.f b/boss/newsk.f index 3705174e7..b4612f616 100644 --- a/boss/newsk.f +++ b/boss/newsk.f @@ -1,5 +1,5 @@ * -* Copyright (c) 2020 NVI, Inc. +* Copyright (c) 2020, 2023 NVI, Inc. * * This file is part of VLBI Field System * (see http://github.com/nvi-inc/fs). diff --git a/boss/opnpf.f b/boss/opnpf.f index a30f7ad8e..af9c6a511 100644 --- a/boss/opnpf.f +++ b/boss/opnpf.f @@ -1,5 +1,5 @@ * -* Copyright (c) 2020 NVI, Inc. +* Copyright (c) 2020, 2023 NVI, Inc. * * This file is part of VLBI Field System * (see http://github.com/nvi-inc/fs). diff --git a/boss/stat.f b/boss/stat.f index 8f9dcc36c..e69c67a5e 100644 --- a/boss/stat.f +++ b/boss/stat.f @@ -1,5 +1,5 @@ * -* Copyright (c) 2020 NVI, Inc. +* Copyright (c) 2020, 2023 NVI, Inc. * * This file is part of VLBI Field System * (see http://github.com/nvi-inc/fs). diff --git a/chekr/dbbcchk.c b/chekr/dbbcchk.c index 4c6cad547..803b18714 100644 --- a/chekr/dbbcchk.c +++ b/chekr/dbbcchk.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020 NVI, Inc. + * Copyright (c) 2020, 2023 NVI, Inc. * * This file is part of VLBI Field System * (see http://github.com/nvi-inc/fs). diff --git a/chekr/mk3drive.f b/chekr/mk3drive.f index 538e78629..68b02648a 100644 --- a/chekr/mk3drive.f +++ b/chekr/mk3drive.f @@ -1,5 +1,5 @@ * -* Copyright (c) 2020 NVI, Inc. +* Copyright (c) 2020, 2023 NVI, Inc. * * This file is part of VLBI Field System * (see http://github.com/nvi-inc/fs). diff --git a/chekr/mk3rack.f b/chekr/mk3rack.f index 0dd737b35..75c45704f 100644 --- a/chekr/mk3rack.f +++ b/chekr/mk3rack.f @@ -1,5 +1,5 @@ * -* Copyright (c) 2020 NVI, Inc. +* Copyright (c) 2020, 2023 NVI, Inc. * * This file is part of VLBI Field System * (see http://github.com/nvi-inc/fs). diff --git a/chekr/rec_brk.c b/chekr/rec_brk.c index 660791e85..e64049f69 100644 --- a/chekr/rec_brk.c +++ b/chekr/rec_brk.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020 NVI, Inc. + * Copyright (c) 2020, 2023 NVI, Inc. * * This file is part of VLBI Field System * (see http://github.com/nvi-inc/fs). diff --git a/clib/dbbc3_cont_cal_util.c b/clib/dbbc3_cont_cal_util.c index f0725c290..d8cc1fe1b 100644 --- a/clib/dbbc3_cont_cal_util.c +++ b/clib/dbbc3_cont_cal_util.c @@ -157,7 +157,10 @@ struct dbbc3_cont_cal_cmd *lcl; if(lcl->mode >= 0 && lcl->mode < NMODE_KEY) strcat(buff,mode_key[lcl->mode]); - if(lcl->polarity >= 0) + if(lcl->polarity != 0 && lcl->mode == 0) { + strcat(buff,",0"); + logit(NULL,202,"de"); + } else if(lcl->polarity >= 0) sprintf(buff+strlen(buff),",%d",lcl->polarity); else strcat(buff,","); diff --git a/clib/dbbc3n_v.c b/clib/dbbc3n_v.c index 2068c44c7..fdd5d29f8 100644 --- a/clib/dbbc3n_v.c +++ b/clib/dbbc3n_v.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020 NVI, Inc. + * Copyright (c) 2020, 2023 NVI, Inc. * * This file is part of VLBI Field System * (see http://github.com/nvi-inc/fs). @@ -97,7 +97,7 @@ int ip[5]; cls_snd(&out_class, buf, strlen(buf) , 0, 0); out_recs++; - ip[0]=1; + ip[0]=8; ip[1]=out_class; ip[2]=out_recs; skd_run("dbbcn",'w',ip); @@ -142,7 +142,7 @@ int ip[5]; out_recs++; } - ip[0]=1; + ip[0]=8; ip[1]=out_class; ip[2]=out_recs; skd_run("dbbcn",'w',ip); @@ -277,7 +277,7 @@ int ip[5]; out_recs++; } - ip[0]=1; + ip[0]=8; ip[1]=out_class; ip[2]=out_recs; skd_run("dbbcn",'w',ip); diff --git a/control/fserr.ctl b/control/fserr.ctl index 1f09d104b..1badca38d 100644 --- a/control/fserr.ctl +++ b/control/fserr.ctl @@ -2312,6 +2312,9 @@ Class buffer error from command response. DD -501 Only DBBC DDC rack types supported in cont_cal command. "" +DE 202 +WARNING: Overriding polarity to '0' for 'cont_cal=off,...'. +"" DE -201 Mode must be one of: off, on, or undef. "" @@ -2624,11 +2627,14 @@ Error decoding dbbcNN/ response, could be a DBBC version mis-match, see error DC DK -451 Class buffer error from command response. "" +DN 24 +DBBC3 multicast: Core3H board times now agree +"" DN 21 DBBC3 multicast: error from select() cleared "" DN 20 -DBBC3 multicast: receiving messages again +DBBC3 multicast: No time-outs in the last 60 attempts; counting stopped. "" DN -1 DBBC3 multicast: error unpacking, packet too small. @@ -2655,7 +2661,7 @@ DN -18 DBBC3 multicast: retrieving interface address from socket (wrong interface?), UNIX?FFF "" DN -20 -DBBC3 multicast: time-out, DBBC3 may not be running +DBBC3 multicast: Time-out; will now count time-outs in background. "" DN -21 DBBC3 multicast: error from select(), UNIX?FFF @@ -2664,7 +2670,13 @@ DN -22 DBBC3 multicast: error from recvfrom(), UNIX?FFF "" DN -23 -DBBC3 multicast: time-out while data_valid is on, some multicast not recorded, probably due to a DBBC3 command +DBBC3 multicast: Time-out while data_valid is on; will now count time-outs in background. +"" +DN -24 +DBBC3 multicast: Core3H boards have different times. +"" +DN -25 +DBBC3 multicast: In the last 60 attempts, there were?WW time-out(s); continuing to count. "" DN -30 Place holder for version string @@ -4690,6 +4702,9 @@ mk6?W: Mark6 return code 9: indeterminate state "" MN -1 Place Holder +"" +NF 8 +WARNING: rdbe?W is not active but has detectors selected, they will be skipped. "" NF 7 Placeholder for large structure correction warning @@ -4712,6 +4727,9 @@ Error occurred while trying to return to AGC: check gain settings NF -6 Error occurred while trying to restore IF att. Check IF att settings. "" +NF -8 +No detectors remain after accounting for inactive RDBEs. +"" NF -10 MCBCN failed setting AGC "" @@ -4835,6 +4853,9 @@ Error decoding dbe_tsys response from rdb?W NF -117 Incorrect IF channel in dbe_tsys response from rdb?W "" +NF -118 +Error processing RDBE data, see message above. +"" PC -1 program error: portopen8: devdb incorrect size. "" @@ -5056,6 +5077,9 @@ Can't read which ports are in use. "" PP -402 Porgram error: Impossible situation in pcalports_dis. +"" +Q1 307 Placeholder for large structure correction warning + "" Q1 -107 No default for detectors. @@ -5099,9 +5123,6 @@ ONOFF, FIVPT, or HOLOG already running. Q1 -306 BBC patching not defined. "" -Q1 -307 -WARNING: Source structure correction greater than 20% for detector ?W. -"" Q1 -308 Unknown IF filter. "" @@ -7670,6 +7691,9 @@ TPICD not set-up: no detectors selected. TC -303 Continuous cal Tsys only available for DBBC DDC. "" +TC -304 +'tpicd=reset' is only available for DBBC3. +"" TE -9 Video converter frequency has not been set "" diff --git a/dbtcn/Makefile b/dbtcn/Makefile index ab2b5ac38..b828a4a05 100644 --- a/dbtcn/Makefile +++ b/dbtcn/Makefile @@ -1,7 +1,7 @@ LIBS = ../clib/clib.a ../poclb/poclb.a ../rtelb/rtelb.a -lm OBJECTS = dbtcn.o open_mcast.o get_if_addr.o read_mcast.o log_mcast.o\ packet_unpack.o calc_ts.o update_shm.o version_check.o\ - perform_swaps.o smooth_ts.o + perform_swaps.o smooth_ts.o time_check.o ../bin/dbtcn: $(OBJECTS) $(LIBS) -lm diff --git a/dbtcn/calc_ts.c b/dbtcn/calc_ts.c index 1e256dc8a..47d3596df 100644 --- a/dbtcn/calc_ts.c +++ b/dbtcn/calc_ts.c @@ -51,7 +51,9 @@ void calc_ts( dbbc3_ddc_multicast_t *t, struct dbbc3_tsys_cycle *cycle, -9e14 tcal < 0 -9e12 no continuous cal -9e10 overflow (except for IFs) + -9e9 on and off are zero -9e8 off is zero + -9e7 on is zero -9e6 infinite -9e4 too negative */ @@ -111,11 +113,15 @@ void calc_ts( dbbc3_ddc_multicast_t *t, struct dbbc3_tsys_cycle *cycle, tsys=9e10; /* so we get $$$$$ on display */ } else if(on >= 65535 || off >= 65535) /* no overflows */ tsys=-9e10; + else if(on==0 && off == 0) /* on and off are zero */ + tsys=-9e9; else if(off == 0) /* off is zero */ tsys=-9e8; + else if(on == 0) /* on is zero */ + tsys=-9e7; else if(diff == 0) /* divide by zero */ tsys=-9e6; - else if((tcal/diff)*0.5*(on+off)<-999.5) /* too negative */ + else if((tcal/diff)*0.5*(on+off)<=-999.5) /* too negative */ tsys=-9e4; else tsys= (tcal/diff)*0.5*(on+off); @@ -145,11 +151,15 @@ void calc_ts( dbbc3_ddc_multicast_t *t, struct dbbc3_tsys_cycle *cycle, tsys=9e10; /* so we get $$$$$ on display */ } else if(on >= 65535 || off >= 65535) /* no overflows */ tsys=-9e10; + else if(on==0 && off == 0) /* on and off are zero */ + tsys=-9e9; else if(off == 0) /* off is zero */ tsys=-9e8; + else if(on == 0) /* on is zero */ + tsys=-9e7; else if(diff == 0) /* divide by zero */ tsys=-9e6; - else if((tcal/diff)*0.5*(on+off)<-999.5) /* too negative */ + else if((tcal/diff)*0.5*(on+off)<=-999.5) /* too negative */ tsys=-9e4; else tsys= (tcal/diff)*0.5*(on+off); @@ -191,11 +201,15 @@ void calc_ts( dbbc3_ddc_multicast_t *t, struct dbbc3_tsys_cycle *cycle, else if(tsys <0.0) tsys=9e10; /* so we get $$$$$ on display */ /* no information on what an overflow is */ + else if(on==0 && off == 0) /* on and off are zero */ + tsys=-9e9; } else if(off == 0) /* off is zero */ tsys=-9e8; + else if(on == 0) /* on is zero */ + tsys=-9e7; else if(diff == 0) /* divide by zero */ tsys=-9e6; - else if((tcal/diff)*0.5*(on+off)<-999.5) /* too negative */ + else if((tcal/diff)*0.5*(on+off)<=-999.5) /* too negative */ tsys=-9e4; else tsys= (tcal/diff)*0.5*(on+off); diff --git a/dbtcn/dbtcn.c b/dbtcn/dbtcn.c index 78a1ddf27..bb1e8c7b8 100644 --- a/dbtcn/dbtcn.c +++ b/dbtcn/dbtcn.c @@ -143,6 +143,8 @@ int main(int argc, char *argv[]) update_shm(&packet,&cycle, itmc, centisec); + time_check(&cycle); + /* check control to get the last state before logging */ iping=shm_addr->dbtcn.iping; diff --git a/dbtcn/dbtcn.h b/dbtcn/dbtcn.h index c2b60072d..e1072bda8 100644 --- a/dbtcn/dbtcn.h +++ b/dbtcn/dbtcn.h @@ -32,3 +32,4 @@ void version_check( dbbc3_ddc_multicast_t *t); void perform_swaps( dbbc3_ddc_multicast_t *t); void smooth_ts( struct dbbc3_tsys_cycle *cycle, int reset, int samples, int filter, float if_param[MAX_DBBC3_IF]); +void time_check( struct dbbc3_tsys_cycle *cycle); diff --git a/dbtcn/read_mcast.c b/dbtcn/read_mcast.c index 4af642983..12e1b86ce 100644 --- a/dbtcn/read_mcast.c +++ b/dbtcn/read_mcast.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020-2022 NVI, Inc. + * Copyright (c) 2020-2023 NVI, Inc. * * This file is part of VLBI Field System * (see http://github.com/nvi-inc/fs). @@ -36,7 +36,7 @@ extern struct fscom *shm_addr; #include "dbtcn.h" // These are in centiseconds -#define TIME_OUT 125 +#define TIME_OUT 145 #define ERROR_PERIOD 2000 ssize_t read_mcast(int sock, char buf[], size_t buf_size, int it[6], @@ -50,8 +50,11 @@ ssize_t read_mcast(int sock, char buf[], size_t buf_size, int it[6], fd_set readfds; int return_select; static int mcast_error = 0; - static int mcast_to = 0; static int old_error = 0; + static int to_count = -1; + static int to_try = 0; + static int was_to = 0; + int time_out; static unsigned was_count_next = 0; unsigned was_count; @@ -63,47 +66,80 @@ ssize_t read_mcast(int sock, char buf[], size_t buf_size, int it[6], was_count=was_count_next; was_count_next=shm_addr->dbbc3_command_count; - /* Read when data available */ + if(to_try > 0) + to_try=to_try%60+1; + + /* set time-out */ + if(was_to) + time_out=100; + else + time_out=TIME_OUT; + was_to=0; + FD_ZERO(&readfds); FD_SET(sock, &readfds); - to.tv_sec=TIME_OUT/100; - to.tv_usec=(TIME_OUT%100)*10000; + to.tv_sec=time_out/100; + to.tv_usec=(time_out%100)*10000; + /* Check if data available */ return_select = select(sock + 1, &readfds, NULL, NULL, &to); - if(return_select == 0) { + if(return_select == 0) { /* time-out */ int dbbc3_cmd=shm_addr->dbbc3_command_active || shm_addr->dbbc3_command_count != was_count; + + was_to=1; + if(!dbbc3_cmd) { - mcast_to=mcast_to%(ERROR_PERIOD/TIME_OUT) + 1; - if(1==mcast_to) { - logit(NULL,-20,"dn"); + to_count++; + if(to_count == 0) { + logit(NULL,-20,"dn"); } } else if(data_valid) { - mcast_to=mcast_to%(ERROR_PERIOD/TIME_OUT) + 1; - if(1==mcast_to) { - logit(NULL,-23,"dn"); + to_count++; + if(to_count == 0) { + logit(NULL,-23,"dn"); } } - return -1; + if(to_count > -1) { /* only if there was a reportable time-out */ + if(to_try < 1) + to_try=1; + else { + if(1 == to_try) { /* summary if a time-out */ + logitn(NULL,-25,"dn",to_count); + to_count=0; + } + } + } + return -1; } else if (return_select < 0) { /* error */ if(old_error != errno) mcast_error = 0; - mcast_error=mcast_error%(ERROR_PERIOD/100) + 1; - if(1==mcast_error) { - logitn(NULL,-21,"dn",errno); - } - old_error=errno; - rte_sleep(100); - return -1; + mcast_error=mcast_error%(ERROR_PERIOD/100) + 1; + if(1==mcast_error) { + logitn(NULL,-21,"dn",errno); + } + old_error=errno; + rte_sleep(100); + return -1; } - if(mcast_to) { - mcast_to=0; - logit(NULL,20,"dn"); + + if(to_try > 0) { /* summary if NOT a time-out */ + if(1 == to_try) { + if(0 == to_count) { + logit(NULL,20,"dn"); + to_count=-1; + to_try=0; + } else { + logitn(NULL,-25,"dn",to_count); + to_count=0; + } + } } + if(mcast_error) { - mcast_error=0; - old_error = 0; - logit(NULL,21,"dn"); + mcast_error=0; + old_error = 0; + logit(NULL,21,"dn"); } if ((n = recvfrom(sock, buf, buf_size, 0, diff --git a/dbtcn/smooth_ts.c b/dbtcn/smooth_ts.c index 4651bb4db..2a12ef8d0 100644 --- a/dbtcn/smooth_ts.c +++ b/dbtcn/smooth_ts.c @@ -31,6 +31,8 @@ #include "packet.h" #include "dbtcn.h" +#define WARN2 5 + static struct { struct { float tsys; @@ -42,17 +44,20 @@ static struct { float tsys_usb; unsigned count_usb; } bbc[MAX_DBBC3_BBC]; -} saved; +} saved, shadow; static void apply_filter(int filter,int samples,float alpha, float param, - float *tsys,float *saved,unsigned *count,unsigned *clipped) + float *tsys,float *saved,unsigned *count,unsigned *clipped, + float *shadow_saved, unsigned *shadow_count) { - if(*tsys<0.0) { - if(1 == filter && 0.0<=*saved && *count >= samples) - ++*clipped; + if(*clipped == UINT_MAX) + *clipped=0; + + if(*tsys<=-999.5 || *tsys >=999.95) { return; - } else if(0.0<=*saved) { - if(*count < samples || 0==filter || 1==filter && param >= 0.0 && 100.0*fabs(*tsys-*saved)/(*saved) < param) { + } else if(-1e4<=*saved && fabs(*saved) >= 0.05) { + float orig_tsys=*tsys; + if(*count < samples || 0==filter || 1==filter && param >= 0.0 && 100.0*fabs((*tsys-*saved)/(*saved)) < param) { *tsys=alpha* *tsys + (1.0-alpha)* *saved; *clipped=0; @@ -62,10 +67,32 @@ static void apply_filter(int filter,int samples,float alpha, float param, *tsys=*saved; ++*clipped; } + if(1==filter && param >=0.0) { +// printf(" before: count %u shadow_count %u shadow_saved %f orig_tsys %f saved %f\n", +// *count,*shadow_count,*shadow_saved,orig_tsys,*saved); + if(*shadow_count > 0) + *shadow_saved=alpha* orig_tsys + (1.0-alpha)* *shadow_saved; + else + *shadow_saved=orig_tsys; + ++*shadow_count; + if(*shadow_count >=samples ) { + if(100.0*fabs((*shadow_saved-*saved)/(*saved)) >= param && *clipped > WARN2+1) { + *tsys=*shadow_saved; + *clipped=UINT_MAX; + *saved=*shadow_saved; + *count=*shadow_count; + } + *shadow_count=0; + } +// printf(" after: count %u shadow_count %u shadow_saved %f orig_tsys %f saved %f\n", +// *count,*shadow_count,*shadow_saved,orig_tsys,*saved); + } } else { *saved=*tsys; *count=1; *clipped=0; + *shadow_saved=*saved; + *shadow_count=*count; } } @@ -76,24 +103,41 @@ void smooth_ts( struct dbbc3_tsys_cycle *cycle, int reset, int samples, if(reset||0>=samples) { for (j=0;jifc[j].tsys; - saved.ifc[j].count=0; - if(0.0ifc[j].tsys && cycle->ifc[j].tsys < 999.95) { + saved.ifc[j].tsys=cycle->ifc[j].tsys; saved.ifc[j].count=1; + } else { + saved.ifc[j].tsys=-9e20; + saved.ifc[j].count=0; + } cycle->ifc[j].clipped=0; + + shadow.ifc[j].tsys=saved.ifc[j].tsys; + shadow.ifc[j].count=saved.ifc[j].count; } for (k=0;kbbc[k].tsys_lsb; - saved.bbc[k].count_lsb=0; - if(0.0bbc[k].tsys_lsb && cycle->bbc[k].tsys_lsb < 999.95) { + saved.bbc[k].tsys_lsb=cycle->bbc[k].tsys_lsb; saved.bbc[k].count_lsb=1; + } else { + saved.bbc[k].tsys_lsb=-9e20; + saved.bbc[k].count_lsb=0; + } cycle->bbc[k].clipped_lsb=0; - saved.bbc[k].tsys_usb=cycle->bbc[k].tsys_usb; - saved.bbc[k].count_usb=0; - if(0.0bbc[k].tsys_usb && cycle->bbc[k].tsys_usb < 999.95) { + saved.bbc[k].tsys_usb=cycle->bbc[k].tsys_usb; saved.bbc[k].count_usb=1; + } else { + saved.bbc[k].tsys_usb=-9e20; + saved.bbc[k].count_usb=0; + } cycle->bbc[k].clipped_usb=0; + + shadow.bbc[k].tsys_lsb=saved.bbc[k].tsys_lsb; + shadow.bbc[k].count_lsb=saved.bbc[k].count_lsb; + shadow.bbc[k].tsys_usb=saved.bbc[k].tsys_usb; + shadow.bbc[k].count_usb=saved.bbc[k].count_lsb; } return; } @@ -105,17 +149,20 @@ void smooth_ts( struct dbbc3_tsys_cycle *cycle, int reset, int samples, for (j=0;jifc[j].tsys,&saved.ifc[j].tsys, - &saved.ifc[j].count,&cycle->ifc[j].clipped); + &saved.ifc[j].count,&cycle->ifc[j].clipped, + &shadow.ifc[j].tsys,&shadow.ifc[j].count); for (k=0;kbbc[k].tsys_lsb,&saved.bbc[k].tsys_lsb, - &saved.bbc[k].count_lsb,&cycle->bbc[k].clipped_lsb); + &saved.bbc[k].count_lsb,&cycle->bbc[k].clipped_lsb, + &shadow.bbc[k].tsys_lsb,&shadow.bbc[k].count_lsb); apply_filter(filter,samples,alpha,param, &cycle->bbc[k].tsys_usb,&saved.bbc[k].tsys_usb, - &saved.bbc[k].count_usb,&cycle->bbc[k].clipped_usb); + &saved.bbc[k].count_usb,&cycle->bbc[k].clipped_usb, + &shadow.bbc[k].tsys_usb,&shadow.bbc[k].count_usb); } } diff --git a/dbtcn/time_check.c b/dbtcn/time_check.c new file mode 100644 index 000000000..597e7a944 --- /dev/null +++ b/dbtcn/time_check.c @@ -0,0 +1,64 @@ +/* + * Copyright (c) 2023 NVI, Inc. + * + * This file is part of VLBI Field System + * (see http://github.com/nvi-inc/fs). + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#include +#include +#include + +#include "../include/params.h" +#include "../include/fs_types.h" +#include "../include/fscom.h" + +#include "packet.h" +#include "dbtcn.h" + +extern struct fscom *shm_addr; + +static int time_error = 0; + +#define ERROR_COUNT 20 + +void time_check( struct dbbc3_tsys_cycle *cycle) +{ + int i, j; + int time_agrees=1; + + for (i=0; idbbc3_ddc_ifs;i++) + if(cycle->ifc[i].time_included) { + for (j=i+1; jdbbc3_ddc_ifs;j++) + if(cycle->ifc[j].time_included && + cycle->ifc[i].time!=cycle->ifc[j].time) { + time_agrees=0; + break; + } + break; + } + + if(time_agrees && time_error) { + logit(NULL,24,"dn"); + time_error=0; + } else if (!time_agrees) { + time_error=time_error%ERROR_COUNT + 1; + if(1==time_error) + logit(NULL,-24,"dn"); + } + + return; +} diff --git a/ddout/recover_log.c b/ddout/recover_log.c index 1273dbd7c..d20fcd3d8 100644 --- a/ddout/recover_log.c +++ b/ddout/recover_log.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020-2021 NVI, Inc. + * Copyright (c) 2020-2021, 2023-2024 NVI, Inc. * * This file is part of VLBI Field System * (see http://github.com/nvi-inc/fs). @@ -23,6 +23,8 @@ #include #include #include +#include +#include #include "../include/params.h" #include "../include/fs_types.h" @@ -33,97 +35,233 @@ extern struct fscom *shm_addr; #define PERMISSIONS 0664 #define BUFFSIZE 512*4096 +static int write_comment(lnamef,fd,buff) +char lnamef[]; +int fd; +char buff[ ]; +{ + off_t offset; + ssize_t count; + int it[6]; + + offset=lseek(fd, -1L, SEEK_END); + if(offset == (off_t) -1) { + perror("\007!! help! ** error seeking last byte"); + return -1; + } + + count=read(fd,buff,1); + if(count < 0) { + perror("\007!! help! ** error reading last byte"); + return -2; + } else if (count == 0) { + fprintf(stderr,"\007!! help! ** couldn't read last byte for unknown reason\n"); + return -3; + } + + if(count == 1 && buff[0] != '\n') { + buff[0]='\n'; + errno=0; + count=write(fd,buff,1); + if(count < 0 || count == 0 && errno !=0) { + perror("\007!! help! ** error writing pre-comment new-line"); + return -4; + } else if(count ==0) { + fprintf(stderr,"\007!! help! ** couldn't add pre-comment new-line for unknown reason\n"); + return -5; + } + } + rte_time(it,&it[5]); + buff[0]='\0'; + int2str(buff,it[5],-4,1); + strcat(buff,"."); + int2str(buff,it[4],-3,1); + strcat(buff,"."); + int2str(buff,it[3],-2,1); + strcat(buff,":"); + int2str(buff,it[2],-2,1); + strcat(buff,":"); + int2str(buff,it[1],-2,1); + strcat(buff,"."); + int2str(buff,it[0],-2,1); + sprintf(buff+strlen(buff),":\"ddout recovered log file, resulting file: '%s'\n",lnamef); + + errno=0; + count=write(fd,buff,strlen(buff)); + if(count < 0 || count == 0 && errno !=0) { + perror("\007!! help! ** error writing comment"); + return -6; + } else if(count ==0) { + fprintf(stderr,"\007!! help! ** couldn't add comment for unknown reason\n"); + return -7; + } + return 0; +} + int recover_log(lnamef,fd) char lnamef[]; int fd; { - int fail, fd2, fd_temp; + int fail, fd2, recovered_in_name; int before, after, seconds; ssize_t count, countw, cum; off_t size, offset; static char buf_copy[BUFFSIZE]; + int inode, inode2; + char file_name[sizeof(FS_ROOT "/log/")+MAX_SKD+sizeof(".log_recovered.XXXXXX")-1]; - fail=FALSE; fd2=open(lnamef,O_RDONLY); /* check to see if the file exists */ - if(fd2<0 && errno == ENOENT) { - shm_addr->abend.other_error=1; - fprintf(stderr,"\007!! help! ** log file '%s' doesn't exist, attempting to recover by copying.\n", - lnamef); + if (fd2 < 0) { + if (errno != ENOENT) + perror("\007!! help! ** error checking for existence of log file"); + else + fprintf(stderr,"\007!! help! ** log file '%s' doesn't exist\n",lnamef); + } else { + struct stat file_stat; + int ret; - fd2 = open(lnamef, O_RDWR|O_SYNC|O_CREAT,PERMISSIONS); /* try to create it */ - if (fd2 < 0) { - fprintf(stderr, - "\007!! help! ** can't create file '%s', giving up\n", - lnamef); - fail=TRUE; - } else { - - /* now try to make a copy */ - size=lseek(fd,0L,SEEK_CUR); - if(size < 0) - perror("determining size of old file to copy, ddout"); - offset=lseek(fd, 0L, SEEK_SET); - if(offset < 0) { - perror("rewinding old file to copy, ddout"); - fprintf(stderr,"\007!! help! ** can't rewind original file, giving up\n"); - fail=TRUE; + ret = fstat(fd, &file_stat); + if (ret < 0) { + perror("\007!! help! ** error getting inode of open log file"); + } else { + inode = file_stat.st_ino; + + ret = fstat(fd2, &file_stat); + if (ret < 0) { + perror("\007!! help! ** error getting inode of file with the open log file's name"); } else { - count=0; - countw=0; - cum=0; - rte_rawt(&before); - seconds=2; - fprintf(stderr, - "\007!! help! ** copying to recover log file '%s', please wait ... starting.\n", - lnamef); - while(count==countw && 0 < (count= read(fd,buf_copy,BUFFSIZE))) { - countw= write(fd2,buf_copy,count); - if(size >0) { - cum+=count; - rte_rawt(&after); - if((after-before)>seconds*100) { - fprintf(stderr, - "\007!! help! ** copying to recover log file '%s', please wait ... %2d%%\n", - lnamef, (int) (cum*100./size)); - seconds=seconds+2; - } - } - } - if(count < 0) { - fprintf(stderr,"\007!! help! ** failed, error reading original file, giving up\n",lnamef); - perror("!! help! ** ddout"); - fail=TRUE; - } else if (count!=0 && count!=countw) { - fprintf(stderr,"\007!! help! ** failed, error writing to '%s', giving up\n",lnamef); - perror("!! help! ** ddout"); - fail=TRUE; - } else - fprintf(stderr, - "\007!! help! ** copying to recover log file '%s', done.\n", - lnamef); + inode2 = file_stat.st_ino; + + if(inode == inode2) + goto done; /* we are good */ + + fprintf(stderr,"\007!! help! ** file '%s' is not the open log file\n", lnamef); } } + } - if(fail) { - fprintf(stderr,"\007!! help! ** you can attempt to recover by unmounting the file system and\n"); - fprintf(stderr,"\007!! help! ** grep-ing the file system for lines starting with the date\n"); - fprintf(stderr,"\007!! help! ** portion of time tag for the date(s) of the session try to\n"); - fprintf(stderr,"\007!! help! ** do as little as possible to the file system until you\n"); - fprintf(stderr,"\007!! help! ** dismount it. Please see /usr2/fs/misc/logrecovery for details.\n"); - } else { - fprintf(stderr,"\007!! help! ** good news, log file '%s' seems to be recovered, please check it.\n",lnamef); - fd_temp=fd; - fd=fd2; - fd2=fd_temp; +/* something went wrong; no matter what it was, we will try to recover the open + log; this is our only chance */ + + shm_addr->abend.other_error=1; + fail=FALSE; + recovered_in_name=FALSE; + cum=0; + + fprintf(stderr,"!! help! ** attempting to recover '%s' by copying\n", lnamef); + if(fd2 >= 0 && close(fd2) < 0) + perror("\007!! help! ** error closing file with the log file name"); + + strcpy(file_name,lnamef); + fd2 = open(file_name, O_RDWR|O_SYNC|O_CREAT|O_EXCL,PERMISSIONS); /* try to create it */ + if (fd2 < 0) { + if(errno != EEXIST) + perror("\007!! help! ** error creating log file"); + else + fprintf(stderr,"\007!! help! ** file '%s' already exists\n",file_name); + + strcat(file_name,"_recovered"); + fd2 = open(file_name, O_RDWR|O_SYNC|O_CREAT|O_EXCL,PERMISSIONS); /* try to create it */ + if (fd2 < 0) { + if(errno != EEXIST) + perror("\007!! help! ** error creating .log_recovery file"); + else + fprintf(stderr,"\007!! help! ** file '%s' already exists\n",file_name); + + strcat(file_name,".XXXXXX"); + fd2 = mkstemp(file_name); /* try to create it */ + if (fd2 < 0) { + if (errno != EEXIST) + perror("\007!! help! ** error creating .log_recovery.XXXXXX file, giving up"); + else + fprintf(stderr,"\007!! help! ** could not create a unique file name, giving up"); + fail=TRUE; + goto fail; + } else + recovered_in_name=TRUE; + } else + recovered_in_name=TRUE; + } + fprintf(stderr,"!! help! ** Good news: created file '%s' for recovery.\n",file_name); + + /* now try to make a copy */ + size=lseek(fd,0L,SEEK_CUR); + if(size < 0) + perror("\007!! help! ** error determining size of open log file to copy: no progress meter"); + offset=lseek(fd, 0L, SEEK_SET); + if(offset < 0) { + perror("\007!! help! ** error rewinding open log file to copy, giving up"); + fail=TRUE; + goto fail; + } + count=0; + countw=0; + rte_rawt(&before); + seconds=2; + fprintf(stderr, + "!! help! ** copying to recovery file: please wait ... starting\n"); + while(count==countw && 0 < (count= read(fd,buf_copy,BUFFSIZE))) { + countw= write(fd2,buf_copy,count); + cum+=count; + rte_rawt(&after); + if((after-before)>seconds*100) { + if(size >0) + fprintf(stderr, + "!! help! ** copying to recovery file: please wait ... %2d%%\n", + (int) (cum*100./size)); + else + fprintf(stderr, + "!! help! ** copying to recovery file: please wait ...\n"); + seconds=seconds+2; } - } else if (fd2 < 0) { - shm_addr->abend.other_error=1; - perror("checking for existence of log file, ddout"); + } + if(count < 0) { + perror("\007!! help! ** error reading open log file, giving up"); + fail=TRUE; + } else if (count!=0 && count!=countw) { + perror("\007!! help! ** error writing recovery file, giving up"); + fail=TRUE; + } else + fprintf(stderr, + "!! help! ** copying to recovery file: done\n"); + +fail: + if(fail) { + fprintf(stderr,"\007!! help! ** You can attempt to recover by unmounting the file system and\n"); + fprintf(stderr,"\007!! help! ** grep-ing the file system for lines starting with the date\n"); + fprintf(stderr,"\007!! help! ** portion of time tag for the date(s) of the session. Try to\n"); + fprintf(stderr,"\007!! help! ** do as little as possible to the file system until you\n"); + fprintf(stderr,"\007!! help! ** dismount it. Please see /usr2/fs/misc/logrecovery.txt for details.\n"); + if(cum>0) { + fprintf(stderr,"!! help! ** Some of the log was recovered before the copying failed.\n"); + fprintf(stderr,"!! help! ** The recovery file is: '%s', please check it.\n",file_name); + } + } else { + int ierr; + + fprintf(stderr,"!! help! ** Good news: the log file seems to be recovered.\n"); + fprintf(stderr,"!! help! ** The recovery file is: '%s', please check it.\n",file_name); + + ierr=write_comment(file_name,fd2,buf_copy); + if(ierr < -5) + fprintf(stderr,"\007!! help! ** problem adding comment at end of recovery file, see above, may be benign\n"); + else if (ierr < -3) + fprintf(stderr,"\007!! help! ** problem adding pre-comment new-line at end of recovery file, see above, may be benign\n"); + else if (ierr < 0) + fprintf(stderr,"\007!! help! ** problem checking for new-line at end of recoverd file, see above, may be benign\n"); + else + fprintf(stderr,"!! help! ** Recovery comment successfully added to recovery file.\n"); + } + + if(recovered_in_name) { + fprintf(stderr,"!! help! ** NOTE WELL: If you re-opened the same log file, the file with that name (whatever it is),\n"); + fprintf(stderr,"!! help! ** NOTE WELL: not the recovery file, is getting the new log entries.\n"); } +done: if(fd2 >= 0 && close(fd2) < 0) { + perror("\007!! help! ** error closing fd2"); shm_addr->abend.other_error=1; - perror("closing fd2, ddout"); } return fd; diff --git a/docs/index.adoc b/docs/index.adoc index d2f73d748..c9b4e58a6 100644 --- a/docs/index.adoc +++ b/docs/index.adoc @@ -1,5 +1,5 @@ // -// Copyright (c) 2020, 2022 NVI, Inc. +// Copyright (c) 2020, 2022, 2023 NVI, Inc. // // This file is part of the FSL10 Linux distribution. // (see http://github.com/nvi-inc/fsl10). @@ -19,11 +19,15 @@ // = Index of fs/ -Version 0.8 - June 2022 +Version 1.1 - December 2023 == Direct Links -<> Update Notes (latest) +<> Update Notes (latest release) + +<> + +<> == Links to sub-directories diff --git a/docs/misc/64-bit_conversion.adoc b/docs/misc/64-bit_conversion.adoc index afb33528e..088d8d012 100644 --- a/docs/misc/64-bit_conversion.adoc +++ b/docs/misc/64-bit_conversion.adoc @@ -1,5 +1,5 @@ // -// Copyright (c) 2020-2022 NVI, Inc. +// Copyright (c) 2020-2023 NVI, Inc. // // This file is part of VLBI Field System // (see http://github.com/nvi-inc/fs). @@ -19,7 +19,7 @@ // = Converting to a 64-bit System -Version 1.2 - August 2021 +Version 1.10.0 - December 2023 //:hide-uri-scheme: :sectnums: @@ -29,96 +29,181 @@ Version 1.2 - August 2021 :toc: :toclevels: 4 -== Introduction +:sectnums!: +== Document revision history + +Click the *Details* toggle below to unhide/hide the history. -This document covers converting to a 64-bit system from an existing -32-bit FS10 system. It is also used as part of the upgrade path to go -directly to 64-bit system while upgrading the FS. +[%collapsible] +==== -The approach here assumes you will be installing a 64-bit system on a new -computer. Doing so will allow you to convert to 64-bit without -disturbing your operational 32-bit system. +* 1.10.0 -- Reorganize to put reference copies in their own directory +first, them make working copies; use _rsync_ instead of _scp_; minor cleanup +* 1.9.1 -- Add *NOTE* about not renaming _/usr2/log_ +* 1.9 -- Remove extraneous `log-old` from `chmod a-w ...` +* 1.8 -- Improve customization of home directories; put Document revision history in a collapsible block +* 1.7 -- Note other formats for `st-_version_` +* 1.6 -- Transfer logs directly to a reference copy +* 1.5 -- Use _root_ on the old system to copy files if possible +* 1.4 -- Add revision history +* 1.3 -- Rewrite to include FSL11 and make useful for more situations +* 1.2 -- Add using ssh-keygen +* 1.1 -- Cleanup +* 1.0 -- Add unlongify TIP +* 0.8 -- Fix typos +* 0.7 -- Font improvements +* 0.6 -- Simplify 64-bit upgrade path +* 0.4 -- Simplify 64-bit upgrade path +* 0.3 -- Initial version + +==== + +:sectnums: +== Introduction + +This document covers converting to a 64-bit system architecture from +an existing FS _10._ installation on a 32-bit system. It is also +used as part of the upgrade path to go directly to a 64-bit system +while upgrading to FS _10.0_. + +The approach here can also be used to transfer an existing 64-bit (or +32-bit) FS installation to a new system without changing OS +(including architecture) and FS version. For that case, in place of +the <> step make sure you have the same OS +(including architecture) and FS version installed on your new system +as on your existing system and then omit the +<> step. + +If you are moving to a different OS, you may need to use a different +FS version and update your station files and software for the new OS +and FS version. For FSL11, a pointer to the instructions for this are +included in its installation guide and in the +<> step below. + +The process in this document assumes you will be installing to a new +system. This will allow you to set up the new system without +disturbing your operational system. == Convert to using a 64-bit system -IMPORTANT: All operations,except where noted, are performed on the -new, 64-bit, system. +IMPORTANT: All operations, except where noted, are performed on the +new system. Please follow the steps below. === Install a 64-bit system -Install a 64-bit system on a different (hopefully new) computer. We -recommend FSL10, which is based on Debian _Stretch_ and tuned for FS -use. The FSL10 installation guide can be found at -https://nvi-inc.github.io/fsl10/. That process installs a base FS. - -NOTE: As indicated in that document, you should checkout the latest release of FS10, which may be a pre-release. - -You can install a different distribution. However, we can't -provide as much support in that case. The FSL10 distribution is -tuned to provide a complete platform for running the FS. For other -distributions you may have to make adjusts for several things that -an FSL10 installation provides, including: +Install a 64-bit (or 32-bit, but 64-bit is recommended) system on a +different (hopefully new) computer. We recommend FSL11, which is based +on Debian _Bullseye_ and tuned for FS use. The FSL11 installation +guide can be found at https://nvi-inc.github.io/fsl11/. That process +installs FS _10.2_. After that instead of the directions in the +current document, you should follow the directions in the appendix +<<../releases/10/2/10.2.adoc#_transferring_an_existing_fs_installation_to_fsl11,Transferring +an existing FS installation to FSL11>> of the +<<../releases/10/2/10.2.adoc#,FS 10.2 Update Notes>> document. Those +instructions include, by reference, a subset of the ones in the +current document. + +NOTE: If you are following these directions as part of installing FS +_10.0_ on FSL10, that will still work, but we recommend using FS +_10.2_ on FSL11 instead. + +You can install a non-FSL__x__ Linux distribution. However, we can't +provide as much support in that case. The FSL11 distribution is tuned +to provide a complete platform for running the FS. For other +distributions you may have to make adjustments for several things that +an FSL11 installation provides, including: - which packages are installed - required user accounts and groups +- backup methods -=== Login as root +=== Login as root on the new system -Login as _root_. +Login as _root_ on the new system. === Rename default directories NOTE: This step assumes you have installed a base FS, either along -with FSL10 or using your own methods. If the latter and the normal +with FSL11 or using your own methods. If the latter, and the normal default FS directories were not created, you can skip this step. . Rename the existing default station specific FS related directories -on the 64-bit computer to get them out of the way: +on the new system to get them out of the way: cd /usr2 mv control control.DEFAULT mv sched sched.DEFAULT mv proc proc.DEFAULT -. If you use the _/usr2/tle_files_ directory on your old computer, -you should rename the one on the 64-bit computer: +. If you use the _/usr2/tle_files_ directory on your old system, you +should rename the one on the new system: cd /usr2 mv tle_files tle_files.DEFAULT -. If your station software is in _/usr2/st-0.0.0_ on your old computer, -you should rename the one on the 64-bit computer: +. If your station software is in _/usr2/st-0.0.0_ on your old system, +you should rename the one on the new system: cd /usr2 mv st-0.0.0 st-0.0.0.DEFAULT -. The _log_ directory were not included above, since it should -essentially be empty on the new computer, but could also be -renamed if you prefer: +NOTE: The _/usr2/log_ directory is not renamed since it will not be +replaced with a copy of the directory from the old system. - cd /usr2 - mv log log.DEFAULT +=== Create directory for reference copies + +It can be useful to have a reference copy of certain parts of the old +system. In particular, you may want to preserve copies of the +operational directories: _control_, _log_, _proc_, and _sched_; the +last version of the station software; the home directories of _oper_ +and _prog_; old reference copies from previous updates; it may also be +useful to preserve _/etc_. For this reason, the file transfer is +organized around making reference copies and then making new working +copies for items where that is appropriate. If you prefer, you can +skip making reference copies and copy the operational directories of +_control_, _log_, _proc_, and _sched_ directly to _/usr2_ on the new +system. + +You can make a directory on _/usr2_ (usually the largest partition and +one with ample room) to hold the reference copies. This might be, +e.g., _/usr2/old_FSL9_, if your previous system was FSL9. You should +use whatever naming scheme is appropriate for your situation. The +current step and the following one use _/usr2/old_FSL9_ as an example. +You should substitute the appropriate directory for your system. + +You can create the reference directory structure with: + + mkdir -p /usr2/old_FSL9/usr2 === Transfer files Your station specific FS related files can be transferred from the old -computer using any convenient method. If both systems are on the -network this can be particularly easy. The following example sub-steps -use this approach. You should replace the _old_ host name in the -examples (and in file names) with your old system's host name. These -commands must be executed as _root_, and except where noted, from the -64-bit system. - -[NOTE] +system using any convenient method. If both systems are on the network +this can be particularly easy. The following example sub-steps use +this approach. You should replace the `_old_` host name in the +examples with your old system's host name. These commands must be +executed as _root_, and except where noted, from the new system. + +As an example, the sub-steps below use _/usr2/old_FSL9_ as the +directory to hold the files from your system. You should substitute +the appropriate directory for your system (see the previous step +(<>). + +TIP: If you want to copy-and-paste the example _rsync_ commands below +as is (this is possible for nearly all of them, the exceptions are the +one for `old:/usr2/st-_version_` and possibly for +`old:/usr2/old_FSL8`), you can add an alias `_old_` for your old +system in the _/etc/hosts_ file on the new system. + +[TIP] ==== -You may need to provide the appropriate password for each _scp_ -command below. If so, you can simplify the process by copying your -64-bit computer's _root_ public SSH keys to the old machine _oper_ and -_prog_ accounts with _ssh-copy-id_ first. If _root_ doesn't have an ID -yet, you will get an error like: +You may need to provide the appropriate password for each _rsync_ +command below. If so, you can simplify the process by copying your new +system's _root_ public SSH keys to the old system with _ssh-copy-id_ +first. If _root_ doesn't have an ID yet, you will get an error like: /usr/bin/ssh-copy-id: ERROR: No identities found @@ -128,61 +213,85 @@ again. ==== -CAUTION: It is assumed that the new installation is on new hardware -with disks more than large enough to accommodate all the data being +NOTE: By default `-a` option of _rsync_ will copy symbolic links but +not their _referents_ (_scp_ will follow the link and copy what it +points to, the referent). This is usually what is appropriate for this +application; it doesn't pull files from other directories. If you want +to copy the referents, please see the `SYMBOLIC{nbsp}LINKS` section of +`*man{nbsp}rsync*` for more information (adding `--copy-links` will +give the behavior of _scp_). + +CAUTION: It is assumed that the new system is on new hardware with +disks more than large enough to accommodate all the data being transferred. However, if you installed the new Linux on old hardware with small disks, there may be a space issue. -WARNING: The instructions below assume that the existing system you -are using has a standard FS configuration in terms of symbolic links -and directories. If your system is different, you will need to adjust -what you do accordingly, but you may still find the outline of steps +WARNING: The instructions below assume that the old system you are +using has a standard FS configuration in terms of symbolic links and +directories. If your system is different, you will need to adjust what +you do accordingly, but you may still find the outline of sub-steps useful. -. Transfer operations directories: +IMPORTANT: These instructions assume that you can login to the old +system as _root_ using _ssh_. Allowing this is a security risk and +should only be permitted temporarily for these command. If you are not +able to allow it, you can use the _oper_ and _prog_ (or other) +accounts on the old system to transfer the files. In that case, there +is risk that some files may not be copied due to ownership/permission +issues. You may need to take other steps to copy those files. + +. Transfer operational directories: + +.. Transfer _control_, _log_, _proc_, and _sched_, from your `_old_` +system: -.. Transfer _control_, _sched_, and _proc_: + [subs="+quotes"] .... -cd /usr2 -scp -pqr oper@_old_:/usr2/control . -scp -pqr oper@_old_:/usr2/sched . -scp -pqr oper@_old_:/usr2/proc . +cd /usr2/old_FSL9/usr2 +rsync -aH _old_:/usr2/control . +rsync -aH _old_:/usr2/log . +rsync -aH _old_:/usr2/proc . +rsync -aH _old_:/usr2/sched . .... + -NOTE: Your _sched_ and _proc_ directories could be -large and take a significant amount of time to transfer. +NOTE: Your _log_ directory could be large and take a significant +amount of time to transfer. -.. Transfer _log_: +.. Transfer _tle_files_: + -It can be useful to have your old log files on the new -computer, but that transfer could take a long time: + +If you use the _/usr2/tle_files_ directory on your `_old_` system, you +can also transfer it: + + [subs="+quotes"] .... -cd /usr2 -scp -pqr oper@_old_:/usr2/log . +cd /usr2/old_FSL9/usr2 +rsync -aH _old_:/usr2/tle_files . .... -.. Transfer _tle_files_: + -If you use the _/usr2/tle_files_ directory on your old -computer, you can also transfer it: + +. Make "`starter`" working copies of the operational directories +(except _log_): + + cd /usr2 + cp -a old_FSL9/usr2/control . + cp -a old_FSL9/usr2/proc . + cp -a old_FSL9/usr2/sched . + + -[subs="+quotes"] -.... -cd /usr2 -scp -pqr oper@_old_:/usr2/tle_files . -.... +and possibly: + + cd /usr2 + cp -a old_FSL9/usr2/tle_files . -. Fix the permissions on the operations directories/files you -transferred. You can fix their permissions and ownerships -to the standard with: +. Fix the ownership/permissions of the working copies you made: /usr2/fs/misc/fix_perm + @@ -193,57 +302,47 @@ NOTE: If you don't have a _/usr2/tle_files_ directory, you will get a message that there is no such directory. That is benign unless you expect such a directory to be there. -. Make back-up copies of the operational directories. This -sub-step is optional but may be useful so that there are -unmodified copies of the directories from the old machine -to use for reference: +. Transfer your station software directory (and make a working copy). +This is usually the target directory pointed to by the _/usr2/st_ +symbolic link. On your old system, you can find its name with: + + ls -l /usr2/st + -[subs="+quotes"] -.... -cd /usr2 -cp -a proc proc-_old_ -cp -a control control-_old_ -cp -a sched sched-_old_ -.... +In the rest of this sub-step, the target `st-_version_` will be used. +You should replace `_version_` with your version string. For example, +use `_1.0.0_`, to make a target `_st-1.0.0_`. (You may need to adjust +these commands if you have a different format for `st-_version_`, +perhaps `_st-git_`.) If your target is `_st-0.0.0_` you should rename +the default on the new system first as described in the +<> step above. + + -and possibly: +All the sub-steps below are executed on the new system: + +.. Copy the target from the `_old_` system to the new system: + + [subs="+quotes"] .... -cd /usr2 -cp -a log log-_old_ -cp -a tle_files tle_files-_old_ +cd /usr2/old_FSL9/usr2 +rsync -aH __old__:/usr2/st-_version_ . .... -. Transfer your station software directory (and make a -reference copy). This is usually the target directory -pointed to by the _/usr2/st_ symbolic link. On your old -computer, you can find its name with: - - ls -l /usr2/st -+ - -In the rest of this sub-step, the target _st-version_ will be used. -You should replace __version__ with your version number. For example, -_1.0.0_, to make a target _st-1.0.0_. If your target is _st-0.0.0_ you -should rename the default on the new computer first as described in -the <> step above. +.. Create a local working copy -.. On the new computer, copy the target from the old computer to the -new computer, e.g.: + [subs="+quotes"] .... cd /usr2 -scp -pqr oper@__old__:/usr2/st-_version_ . +cp -a old_FSL9/usr2/st-_version_ . .... -.. On the new computer, set the _/usr2/st_ symbolic link to point to -the target directory: +.. Set the _/usr2/st_ symbolic link to point to the target directory: + + [subs="+quotes"] @@ -252,102 +351,197 @@ cd /usr2 ln -fsn st-_version_ st .... -.. On the new computer, you can set its permissions and ownership for -_prog_ with: -+ +.. Set its ownership to prevent users other than _prog_ from modifying +it: ++ [subs="+quotes"] .... cd /usr2 chown -R prog.rtx st-_version_ -chmod -R a+r,u+w,go-w st-_version_ +chmod -R go-w st-_version_ .... -.. On the new computer, you can make a reference copy with (_old_ is -the name of your old computer): ++ + +. Copy your _oper_ and _prog_ directories to the new system. This +sub-step is optional. The FSL11 installation made default home +directories for these users on _/usr2_. If you had not customized +content for the users on the old system, you could just use the +versions on the new system. Still it may be useful to have a copy of +your old directories on the new system for reference, especially if +you realize later that there were additional programs and files you +want to use on the new system. You can accomplish the transfers as +_root_ using: + + [subs="+quotes"] .... -cd /usr2 -cp -a st-_version_ st-_version-old_ +cd /usr2/old_FSL9/usr2 +rsync -aH _old_:/usr2/oper . +rsync -aH _old_:/usr2/prog . .... -. Copy your _oper_ and _prog_ directories to the new computer. This -sub-step is optional. The FSL10 installation made default home -directories for these users on _/usr2_. If you did not have -customized content for the users on the old computer, you could just -use the versions on the new computer. Still it may be useful to have a -copy of your old directories on the new system for reference, -especially if you realize later that there were additional programs -and files you want to use on the new system. In the commands below -_old_ is the name of your old computer. - -.. You can accomplish the transfers as _root_ using: +. Transfer other files. + + +You may need or want copies of other directories. These might include: +_/etc_; _/usr/local/sbin_ and _/usr/local/bin_ (for RAID and AUID +scripts); other directories from _/usr2_: + ++ [subs="+quotes"] .... -cd /usr2 -scp -pqr oper@_old_:~ oper-_old_ -scp -pqr prog@_old_:~ prog-_old_ +cd /usr2/old_FSL9 +rsync -aH --copy-links _old_:/etc . +rsync -aH --mkpath _old_:/usr/local/sbin usr/local/sbin +rsync -aH --mkpath _old_:/usr/local/bin usr/local/bin +... .... -.. You probably want to set their permission and ownership so the -appropriate users are allow to access them: + +and possibly reference copies of even older installations +(`/usr2/old_FSL8` and/or others): + ++ [subs="+quotes"] .... -chown -R oper.rtx /usr2/oper-_old_ -chmod -R a+r,u+w,go-w /usr2/oper-_old_ - -chown -R prog.rtx /usr2/prog-_old_ -chmod -R a+r,u+w,go-w /usr2/prog-_old_ +cd /usr2/ +rsync -aH __old__:/usr2/old_FSL8 . +... .... +. Set the permissions of the reference directory. + + -You can customize the home directories on the new computer + +You should probably set the entire directory to _not_ have write +permission: + + cd /usr2 + chmod -R a-w old_FSL9 + +=== Optional cleanup + +IMPORTANT: This optional step is to be performed by _oper_. Be sure to +change accounts if you decide to do it. + +If you would like, you can make a clean start by deleting old +experiment files from _/usr2/proc_ and _/usr2/sched_. Copies of the +files deleted are preserved in the reference directory in case they +are ever needed. + +One possible strategy is to identify the most recent file you _want_ +to delete (the `*lt*` alias, or the `*ls{nbsp}-lt{nbsp}|{nbsp}less*` +command, is useful for identifying it). In _/usr2/proc_, for example, +that might be _vo3347gs.prc_. Working as _oper_ enter: + +TIP: If you use this method, make sure that _station.prc_, +_point.prc_, and any other procedure libraries that you use routinely, +have been updated more recently than the file you identified. The +_touch_ command could be used to change their modification times. + + cd /usr2/proc + find . -type f ! -newer vo3347gs.prc | xargs rm -f + +Likewise for _/usr2/sched_, the most recent file you _want_ to delete +might, for example, be _vo3347gs.lst_. Working as _oper_ enter: + +TIP: If you use this method, make sure that any other procedure files +(typically _.snp_ files) that you use routinely, have been updated +more recently than the file you identified. + + cd /usr2/sched + find . -type f ! -newer vo3347gs.lst | xargs rm -f + +If you accidentally delete any files that you wanted to keep from +either directory, you can copy them (as _oper_) from the reference +directory when you discover they are missing. Files copied later in +this scenario may require changes depending on the details of the FS +updates you apply before then. + +Other approaches can be used for delete files you don't want. You +could also delete any sub-directory structure in either or both of +these directories, if you want. + +=== Customize files on the new system + +There are several things you may need to adjust on the new system. +These include: + +.. Install additional Debian packages + ++ + +You may need to install packages for your new system that you had +installed on the old system. + +.. Copy/merge additional system files, such as: + ++ +[disc] +* _/etc/hosts_ +* _/etc/ntp.conf_ +* _/etc/hosts.allow_ +* _/etc/hosts.deny_ + +.. Customize the _oper_ and _prog_ home directories on the new system to include any features you want from the old system. -. At this point you are principle done transferring files. -However, it is also possible that you may need or want -other files or changes such as: ++ + +This would typically include updating the default _~/.profile_, +_~/.bashrc_, _~/.bash_aliases_, and _~/bin_. If you were previously +using _tcsh_ (the default for FSL9 and earlier) and are now changing +to _bash_ (the default for FSL10 and later), you will need to +translate customized settings from your _~/.login_ and _~/.cshrc_ +files. + +.. Update operational directories _control_, _proc_, and _sched_ -.. Copy other files or programs from the old system + -This might include directories and log files that exist as copies from even older computers. -.. Install additional Debian packages -.. Copy/merge additional configuration files, such as: +If you will be using a new FS version on the new system you may need +to update files in these directories (and others). This is covered in +the update notices you will need to apply for the new version. - /etc/hosts - /etc/hosts.allow - /etc/hosts.deny - /etc/ntp.conf +.. Update station software + -You can use a similar process to the one above to transfer -and/or make reference copies of more files and directories. -=== Login as prog +If you are moving to a new FS and FSL__x__ version, any needed changes +are covered in the FS update notice. If you are converting to 64-bit, +instructions can be found in the following steps. -Login as _prog_. ++ + +If there is other software you use, you would need to install that as +well. + +=== Login as prog on the new system -=== Update station programs +The following steps up to <> should be executed as _prog_ on +the new system. -This step is for modifying your station programs in _/usr2/st_. There +=== Update station programs for 64-bit + +This step is for modifying your station programs in _/usr2/st_. There are two possible issues, conversion of FORTRAN code and conversion of C code. +NOTE: If you are not converting from 32- to 64-bit, you should skip +this step and go directly to the <> step below. + ==== Conversion of FORTRAN code If you don't have any FORTRAN station code or you have already converted it to _f95_, skip this sub-step. -Use of _f95_ is necessary -on 64-bit systems. If you have station programs -in FORTRAN, please email Ed so he is aware. +Use of _f95_ is necessary on 64-bit systems. If you have station +programs in FORTRAN, please email Ed so he is aware. You will need to adapt your __Makefile__s to use the same compiler options as the FS, which can be @@ -362,16 +556,17 @@ to your __Makefile__s for FORTRAN programs: If you don't have any C station code, you can skip this sub-step. -If you have C station code, it should work as written unless -you have declared integers that interface to the FS as `long`. -For a start at fixing those, please see -https://github.com/dehorsley/unlongify. -The following steps describe how to install and use the _unlongify_ tool. +If you have C station code, it should work as written unless you have +declared integers that interface to the FS as `long` (this was +actually a common practice due to the example code that been +provided). For a start at fixing those, please see +https://github.com/dehorsley/unlongify. The following sub-steps +describe how to install and use the _unlongify_ tool. ===== Install go language If you haven't already, you will need to first install the _go_ -language. If you are using FSL10, you can install the _go_ language in +language. If you are using FSL11, you can install the _go_ language in one of two ways listed below: . <