From 3ec46582087d9ffc527d75e8ab3da72ccfa51779 Mon Sep 17 00:00:00 2001 From: Koennecke Mark Date: Mon, 8 Feb 2016 09:23:42 +0100 Subject: [PATCH] A number of smaller adpations --- epicsadapter.c | 4 ++-- tabledrive.c | 5 +--- tasscan.c | 6 ++--- utils/decodehmdata.c | 29 ++++++++++++++++++++++++ utils/deploysics | 3 ++- utils/testtransfer | 54 ++++++++++++++++++++++++++++++++++++++++++++ 6 files changed, 91 insertions(+), 10 deletions(-) create mode 100755 utils/decodehmdata.c create mode 100755 utils/testtransfer diff --git a/epicsadapter.c b/epicsadapter.c index fe76628..8327cdd 100644 --- a/epicsadapter.c +++ b/epicsadapter.c @@ -19,8 +19,8 @@ One of those: alarmString.h cannot be doubly included into the same application */ -/*#include */ -extern char *epicsAlarmConditionStrings[]; +#include +/* extern char *epicsAlarmConditionStrings[]; */ /* * we have a SICS tasks which polls EPICS regularly. diff --git a/tabledrive.c b/tabledrive.c index 3a4219e..34323c7 100644 --- a/tabledrive.c +++ b/tabledrive.c @@ -298,11 +298,8 @@ static void tableInfo(pTableDrive self, SConnection * pCon) /*------------------------------------------------------------------------*/ static void tableSetPar(pMotor pMot, char *name, float value) { - ObPar *ob = NULL; - ob = ObParFind(pMot->ParArray, name); - assert(ob != NULL); - ob->fVal = value; + MotorSetPar(pMot,pServ->dummyCon,name,value); } /*------------------------------------------------------------------------ diff --git a/tasscan.c b/tasscan.c index 2d8bc19..c6d8a89 100644 --- a/tasscan.c +++ b/tasscan.c @@ -400,8 +400,8 @@ static int TASHeader(pScanData self) start with the scan variables */ if (pTAS->iPOL >= 0) { - strcpy(pBueffel, "FORMT: (I4,I4,"); - strcpy(pHeader, " PNT PAL"); + strcpy(pBueffel, "FORMT: (I4,I4,1X,"); + strcpy(pHeader, " PNT PAL"); } else { strcpy(pBueffel, "FORMT: (I4,1X,"); strcpy(pHeader, " PNT "); @@ -495,7 +495,7 @@ static int TASScanPoint(pScanData self, int iPoint) write point number */ if (pTAS->iPOL > 0) { - sprintf(pBueffel, "%3d %3d", iPoint + 1, pTAS->iPOL); + sprintf(pBueffel, "%3d %3d ", iPoint + 1, pTAS->iPOL); } else { sprintf(pBueffel, "%4d ", iPoint + 1); } diff --git a/utils/decodehmdata.c b/utils/decodehmdata.c new file mode 100755 index 0000000..06941ec --- /dev/null +++ b/utils/decodehmdata.c @@ -0,0 +1,29 @@ +/** +* This is a little program which reads the content of a historgram +* memory data file and prints the values to stdout +* +* Mark Koennecke, Gerd Theidel, September 2005 +*/ +#include + +int main(int argc, char *argv[]){ + FILE *fd = NULL; + int val; + + if(argc < 2){ + puts("Usage:\n\tdecodehmdata datafile\n"); + exit(1); + } + + fd = fopen(argv[1],"r"); + if(fd == NULL){ + puts("Cannot open data file\n"); + exit(1); + } + while(fread(&val,sizeof(int),1,fd) == 1){ + fprintf(stdout,"%d\n",ntohl(val)); + } + fclose(fd); + exit(0); +} + diff --git a/utils/deploysics b/utils/deploysics index 4705fb6..d494b63 100755 --- a/utils/deploysics +++ b/utils/deploysics @@ -21,7 +21,8 @@ proc replaceServer {inst} { execCommand "ssh ${inst}@${inst} monit stop sicsserver" execCommand "ssh ${inst}@${inst} monit stop simserver" execCommand "scp ./SICServer ${inst}@${inst}:${inst}_sics" - execCommand "ssh ${inst}@${inst} updatesicscommon" + execCommand "ssh ${inst}@${inst} rm ${inst}_sics/core.*" +# execCommand "ssh ${inst}@${inst} updatesicscommon" execCommand "ssh ${inst}@${inst} monit start sicsserver" execCommand "ssh ${inst}@${inst} monit start simserver" } diff --git a/utils/testtransfer b/utils/testtransfer new file mode 100755 index 0000000..62ac4e6 --- /dev/null +++ b/utils/testtransfer @@ -0,0 +1,54 @@ +#!/usr/bin/tclsh +#---------------------------------------------------------- +# A script for testing if the transfer of data files +# from instrument computers to AFS works +# +# Mark Koennecke, December 2015 +#---------------------------------------------------------- + +set instlist [list amor boa dmc eiger focus hrpt mars \ + morpheus narziss orion poldi rita2 sans sans2 tasp trics] + + +proc execCommand {command} { + puts stdout "Doing $command" + set status [catch {eval exec $command} msg] + if {$status != 0} { + puts stdout "ERROR: $msg " + } +} +#----------------------------------------------------------- +proc testTransfer {inst} { + set year [clock format [clock seconds] -format "%Y"] + set tmpfile /tmp/gaga.dat + execCommand "ssh ${inst}@${inst} cat data/${year}/DataNumber > $tmpfile" + set f [open $tmpfile r] + set num [string trim [gets $f]] + set hun [expr $num /1000] + set filename [format "/afs/psi.ch/project/sinqdata/%s/%s/%03d/%s%4dn%06d.*" \ + $year $inst $hun $inst $year $num] + set status [catch {glob $filename} l] + if {$status == 0 && [llength $l] >= 1} { + puts stdout "$inst is good" + } else { + puts stdout "File $filename not fond, problem at $inst" + } +} + +if {[llength $argv] < 1} { + puts stdout "usage:\n\ttesttransfer instname| all" + exit 1 +} + +set inst [lindex $argv] + +if {[string compare $inst all] == 0} { + foreach inst $instlist { + testTransfer $inst + } +} else { + testTransfer $inst +} + +puts stdout "Done" +