User Tools

Site Tools


computing:voms_script

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
computing:voms_script [2017/02/27 14:57] iwncomputing:voms_script [2020/01/31 13:55] (current) iwn
Line 1: Line 1:
-Use this code snippet to automatically check whether the VOMS proxy needs to be prolonged:+Use this code snippet in a setup script to automatically check whether the VOMS proxy needs to be prolonged:
 <code> <code>
-if [[ $(voms-proxy-info --timeleft) < 18000 ]]; then # hours +#! /bin/bash 
-   echo '>>> voms-proxy-init -voms cms -valid 200:0' +function peval { echo ">>> $@"; eval "$@";
-   voms-proxy-init -voms cms -valid 200:0 + 
-else echo ">>> voms still valid for another `date -u -d @$(voms-proxy-info --timeleft) +"%-d days %-H hours %-M minutes"`"+echo ">>> voms-proxy-info --timeleft" 
 +TIMELEFT=$(voms-proxy-info --timeleft) 
 +if [[ $TIMELEFT -lt 36000 ]]; then # 10 hours 
 +   if [[ $TIMELEFT -gt 0 ]]; then 
 +     echo ">>> voms valid for less than 10 hours (`date -u -d @$TIMELEFT +"%-H hours, %-M minutes and %-S seconds"`)" 
 +   else 
 +     echo ">>> voms not valid anymore..." 
 +   fi 
 +   peval "voms-proxy-init -voms cms -valid 200:0" 
 +elif [[ "$1" = "-f" ]]; then 
 +  peval "voms-proxy-init -voms cms -valid 200:0" 
 +else 
 +  echo ">>> voms still valid for another `date -u -d @$TIMELEFT +"%-d days%-H hours and %-M minutes"`"
 fi fi
 </code> </code>
computing/voms_script.1488203861.txt.gz · Last modified: 2017/02/27 14:57 by iwn