A number of smaller adpations
This commit is contained in:
29
utils/decodehmdata.c
Executable file
29
utils/decodehmdata.c
Executable file
@@ -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 <stdio.h>
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
@@ -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"
|
||||
}
|
||||
|
||||
54
utils/testtransfer
Executable file
54
utils/testtransfer
Executable file
@@ -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"
|
||||
|
||||
Reference in New Issue
Block a user