Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- boinc_path="/home/luis/Applicazioni/boinc"
- lhc_project_url="https://lhcathome.cern.ch/lhcathome/"
- atlas_app_name="ATLAS"
- boinccmd="./boinccmd"
- function isAtlasTask()
- {
- init_data="$boinc_path/slots/$1/init_data.xml"
- if [ -e "$init_data" ]; then
- app_name=$(sed -n 's|[^<]*<app_name>\([^<]*\)</app_name>[^<]*|\1\n|gp' $init_data)
- if [[ "$app_name" == "$atlas_app_name" ]]; then
- return 1
- else
- return 0
- fi
- fi
- return 0
- }
- slot_dirs=( $(ls "$boinc_path/slots"))
- ndirs=${#slot_dirs[@]}
- for (( i = 0; i < ndirs; i++ )) do
- isAtlasTask $i
- if [ $? -eq 1 ]; then
- stderr="$boinc_path/slots/$i/stderr.txt"
- c=0 # cvmfs fails counter
- j=0 # lines counter
- jf=0 # cvmfs fail flag (used as line number too)
- ljf=0 # previous cvmfs fail flag
- while IFS= read -r line; do
- if [[ "$line" == *"Probing /cvmfs/"*"... Failed!" ]]; then
- c=$((c+1))
- jf=$((j+1)) # Current line contains a fail
- ljf=$jf # Current line is the last line containing a fail
- fi
- if [ $jf -eq 0 -a $c -gt 0 ]; then # Current line doesn't contain a fail AND there were fails before
- echo "$c consecutive probing fails found in $stderr after line No. $ljf"
- if [ $c -ge 3 ]; then
- boinc_task_state="$boinc_path/slots/$i/boinc_task_state.xml"
- task_name=$(sed -n 's|[^<]*<result_name>\([^<]*\)</result_name>[^<]*|\1\n|gp' $boinc_task_state)
- cd $boinc_path && $boinccmd --task $lhc_project_url $task_name suspend #abort
- echo "$task_name suspended!" #aborted!"
- fi
- c=0 # Resetting cvmfs fails counter, all necessary actions taken
- fi
- j=$((j+1))
- jf=0 # Resetting cvmfs fail flag for next line
- done < "$stderr"
- fi
- done
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement