A number of smaller adpations

This commit is contained in:
2016-02-08 09:23:42 +01:00
parent 4d5468458b
commit 3ec4658208
6 changed files with 91 additions and 10 deletions

54
utils/testtransfer Executable file
View 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"