Skip to content
Snippets Groups Projects
Commit 8146355b authored by Marco Malavolti's avatar Marco Malavolti
Browse files

Fixed environment variables

parent 4c128d05
No related branches found
No related tags found
No related merge requests found
...@@ -181,11 +181,9 @@ Note: Pay attetion on the chromedriver version: ...@@ -181,11 +181,9 @@ Note: Pay attetion on the chromedriver version:
* CentOS: * CentOS:
* `vim $HOME/.bash_profile` * `vim $HOME/.bash_profile`
* `PATH=$PATH:$HOME/.local/bin:$HOME/bin` becomes `PATH=$HOME/eccs2/eccs2venv/bin:$HOME/.local/bin:$HOME/bin:$PATH` * `PATH=$PATH:$HOME/.local/bin:$HOME/bin` becomes `PATH=$HOME/eccs2/eccs2venv/bin:$HOME/.local/bin:$HOME/bin:$PATH`
* `source $HOME/.bash_profile`
* Debian: * Debian:
* `vim $HOME/.profile` * `vim $HOME/.profile`
* `PATH="$HOME/bin:$PATH"` becomes `PATH="$HOME/eccs2/eccs2venv/bin:$HOME/bin:$PATH"` * `PATH="$HOME/bin:$PATH"` becomes `PATH="$HOME/eccs2/eccs2venv/bin:$HOME/bin:$PATH"`
* `source $HOME/.bash_profile`
3. Configure ECCS2 cron job for the local user: 3. Configure ECCS2 cron job for the local user:
* `crontab -e` * `crontab -e`
......
...@@ -4,6 +4,8 @@ ...@@ -4,6 +4,8 @@
BASEDIR=$HOME BASEDIR=$HOME
source $HOME/.bash_profile
# Remove old IdP and Fed List # Remove old IdP and Fed List
rm -f $BASEDIR/eccs2/input/*.json rm -f $BASEDIR/eccs2/input/*.json
...@@ -21,44 +23,48 @@ suffix="'" ...@@ -21,44 +23,48 @@ suffix="'"
eccs2output="$BASEDIR/eccs2/output/eccs2_$date.log" eccs2output="$BASEDIR/eccs2/output/eccs2_$date.log"
declare -a eccs2cmdToRemoveArray declare -a eccs2cmdToRemoveArray
if [ -s $file ]; then if [ -s $eccsoutput ]; then
if [ -s $file ]; then
while IFS= read -r line while IFS= read -r line
do do
string=$line string=$line
#remove "prefix" from the command string at the beginning. #remove "prefix" from the command string at the beginning.
prefix_removed_string=${string/#$prefix} prefix_removed_string=${string/#$prefix}
#remove "suffix" from the command string at the end. #remove "suffix" from the command string at the end.
suffix_removed_string=${prefix_removed_string/%$suffix} suffix_removed_string=${prefix_removed_string/%$suffix}
entityIDidp=$(echo "$suffix_removed_string" | jq '.entityID') entityIDidp=$(echo "$suffix_removed_string" | jq '.entityID')
#remove start and end quotes from the entityIDidp to be able to use "grep" #remove start and end quotes from the entityIDidp to be able to use "grep"
entityIDidp="${entityIDidp:1}" entityIDidp="${entityIDidp:1}"
entityIDidp="${entityIDidp%?}" entityIDidp="${entityIDidp%?}"
result=$(grep $entityIDidp $eccs2output | wc -l) result=$(grep $entityIDidp $eccs2output | wc -l)
if [[ "$result" = 1 ]]; then if [[ "$result" = 1 ]]; then
eccs2cmdToRemoveArray+=("$entityIDidp") eccs2cmdToRemoveArray+=("$entityIDidp")
else else
echo "The result for the IdP '$entityIDidp' has been found multiple times on $eccs2output. It is wrong." echo "The result for the IdP '$entityIDidp' has been found multiple times on $eccs2output. It is wrong."
fi fi
done <"$file" done <"$file"
# Remove IdP command that had success from "failed-cmd.sh" # Remove IdP command that had success from "failed-cmd.sh"
for idpToRemove in ${eccs2cmdToRemoveArray[@]} for idpToRemove in ${eccs2cmdToRemoveArray[@]}
do do
$(grep -v $idpToRemove $file > temp ; mv -f temp $file) $(grep -v $idpToRemove $file > temp ; mv -f temp $file)
done done
fi
if [ -s $file ]; then if [ -s $file ]; then
echo "$date - ECCS2 NOT OK: Some eduGAIN IdPs have remained unchecked. See the 'logs/failed-cmd.sh' and logs/stderr_$date.log files" echo "$date - ECCS2 NOT OK: Some eduGAIN IdPs have remained unchecked. See the 'logs/failed-cmd.sh' and logs/stderr_$date.log files"
else
echo "$date - ECCS2 OK: All eduGAIN IdPs have been checked successfully"
fi
fi
else else
echo "$date - ECCS2 OK: All eduGAIN IdPs have been checked successfully" echo "$date - Something went wrong and the ECCS2 check has not been executed"
fi fi
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment