Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
E
eduGAIN Connectivity Check
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
edugain
eduGAIN Connectivity Check
Commits
9e43d640
Commit
9e43d640
authored
4 years ago
by
Marco Malavolti
Browse files
Options
Downloads
Patches
Plain Diff
Fixed CRON job & log
parent
9ec9cbb3
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
README.md
+2
-0
2 additions, 0 deletions
README.md
cleanAndRunEccs2.sh
+39
-27
39 additions, 27 deletions
cleanAndRunEccs2.sh
with
41 additions
and
27 deletions
README.md
+
2
−
0
View file @
9e43d640
...
@@ -191,6 +191,8 @@ Note: Pay attetion on the chromedriver version:
...
@@ -191,6 +191,8 @@ Note: Pay attetion on the chromedriver version:
*
`crontab -e`
*
`crontab -e`
```bash
```bash
SHELL=/bin/bash
0 4 * * * /bin/bash $HOME/eccs2/cleanAndRunEccs2.sh > $HOME/eccs2/logs/eccs2cron.log 2>&1
0 4 * * * /bin/bash $HOME/eccs2/cleanAndRunEccs2.sh > $HOME/eccs2/logs/eccs2cron.log 2>&1
```
```
...
...
This diff is collapsed.
Click to expand it.
cleanAndRunEccs2.sh
+
39
−
27
View file @
9e43d640
#!/bin/bash
#!/bin/bash
source
$HOME
/.bash_profile
# logs/stderr_$date.log is kept to see which IdP had been errors
# logs/stderr_$date.log is kept to see which IdP had been errors
BASEDIR
=
$HOME
BASEDIR
=
$HOME
# Remove old IdP and Fed List
# Remove old IdP and Fed List
rm
-f
$BASEDIR
/eccs2/input/
*
.json
#
rm -f $BASEDIR/eccs2/input/*.json
# Run ECCS2
# Run ECCS2
$BASEDIR
/eccs2/runEccs2.py
#
$BASEDIR/eccs2/runEccs2.py
# Run Failed Command again
# Run Failed Command again
bash
$BASEDIR
/eccs2/logs/failed-cmd.sh
bash
$BASEDIR
/eccs2/logs/failed-cmd.sh
...
@@ -21,34 +23,44 @@ suffix="'"
...
@@ -21,34 +23,44 @@ suffix="'"
eccs2output
=
"
$BASEDIR
/eccs2/output/eccs2_
$date
.log"
eccs2output
=
"
$BASEDIR
/eccs2/output/eccs2_
$date
.log"
declare
-a
eccs2cmdToRemoveArray
declare
-a
eccs2cmdToRemoveArray
while
IFS
=
read
-r
line
if
[
-s
$file
]
;
then
do
string
=
$line
while
IFS
=
read
-r
line
do
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"
for
idpToRemove
in
${
eccs2cmdToRemoveArray
[@]
}
# Remove IdP command that had success from "failed-cmd.sh"
do
for
idpToRemove
in
${
eccs2cmdToRemoveArray
[@]
}
$(
grep
-v
$idpToRemove
$file
>
temp
;
mv
-f
temp
$file
)
do
done
$(
grep
-v
$idpToRemove
$file
>
temp
;
mv
-f
temp
$file
)
done
fi
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"
else
echo
"
$date
- ECCS2 OK: All eduGAIN IdPs have been checked successfully"
fi
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment