#!/bin/bash RASPs="Chamber PwSp Bt Et Disch" RASPs="Chamber Disch PwSp" BUONs="PS DAS" OSCs="EtOsc BtOsc PwSpOsc" DASs="Tektr6Standard" ARDs="Trigger" #PAPs="PowSupPap" VIRTDevs="" ALLDevs="$RASPs $OSCs" #ALLDevs="$RASPs $OSCs $DASs $PAPs" INFRASTRDevs="$RASPs $VIRTDevs" GM="golem@golem" sshGM="ssh $GM" XTERM="xterm -T $Dev -e ssh golem@$Dev" LogBook="Shots/$ShotNo/$ThisDev.lgb" DataB="psql -qAt -U golem golem_database" SHM="/dev/shm/golem" SHM0="/dev/shm/golem/0" SHMdir="$SHM0/$SUBDIR/$ThisDev" NULL="1>/dev/null" Ev2NULL="1>/dev/null 2>/dev/null" DirigentDir="/GW/SW/ControlSW/Dirigent" #oscilosc="nc -w 1 "$ThisDev"Osc 5555" oscilosc_stream="netcat "$ThisDev"Osc 5555" oscilosc_w1="netcat -w 1 "$ThisDev"Osc 5555" #oscilosc="socat -t 1 - TCP:"$ThisDev"Osc:5555" #RUNinBACKGR="&> /dev/null" RUNinBACKGR="&" DOWNTO="Diving into" UPFROM="Ascending from" PASSING="Passing .." #2> >(tee -a $SHM/stderr.log >&2) function Dirigent() { echo "$@" >> $SHM/Dirig/CommandsStreamToDirigent #LogIt "Halo, Dirigent ... spatne" #ssh golem@gm "source Dirigent.sh; $@" } function Chamber() { echo "$@" >> $SHM/Dirig/CommandsStreamToChamber } function Discharge() { echo "$@" >> $SHM/Dirig/CommandsStreamToDisch } function Charger() { echo "$@" >> $SHM/Dirig/CommandsStreamToPwSp } function CommonInit() { $sshGM mkdir -p $SHMdir; mkdir -p $SHMdir } function LogIt() { echo `date '+%H:%M:%S'`\\t ${FUNCNAME[1]} $1 >> $SHM/LocalLogBook printf "source Dirigent.sh;DirigentLogIt `date +%H:%M:%S` HashTag$ShotNo $ThisDev/${FUNCNAME[1]}:\t%s\n" "$1" >> $SHM/CommandsStreamToDirigent #| expand -t 33 } function critical_error() { LogIt "Critical error: $1 ... Stopped" echo pack [label .error -text {Critical error: $1 ... stopped}]|wish } function RelayON() { echo "import lib as lib;lib.gpio_low($1)"|python 1>&- 2>&-; } function UnPiRelayON() { echo "from unipi.relays.controller import RelaysController;c = RelaysController();c.relay($1, True)"|python3 1>&- 2>&-; } function UnPiRelayOFF() { echo "from unipi.relays.controller import RelaysController;c = RelaysController();c.relay($1, False)"|python3 1>&- 2>&-; } function RelayOFF() { echo "import lib as lib;lib.gpio_high($1)"|python 1>&- 2>&-; } function GetScreenShot() { LogIt "Acquiring OSC screenshot .." echo ":DISPLAY:DATA? ON,OFF,PNG" |$oscilosc_w1| dd bs=1 skip=11 of=$SHMdir/"$ThisDev"Osc.png status=none &> /dev/null scp $SHMdir/"$ThisDev"Osc.png $GM:$SHMdir/ } function ps_grep_awk_kill () { ps -Af|grep $1|awk '{ print $2 }'|xargs kill } function OscValue() { tail -1 $SHM/OscRespondStream|xargs printf '%4.0f\n' }