Skip to content
Snippets Groups Projects
Verified Commit acfc4540 authored by David Beniamine's avatar David Beniamine
Browse files

Abort on errors

parent 5534cd15
Branches
No related tags found
No related merge requests found
...@@ -28,20 +28,31 @@ then ...@@ -28,20 +28,31 @@ then
exit 1 exit 1
fi fi
safe_run(){
$@
code=$?
if [ $code -ne 0 ]
then
echo "Error while running $1"
exit $code
fi
}
logfile="/var/log/`basename $0`_`date +%Y%m%d-%H%M`" logfile="/var/log/`basename $0`_`date +%Y%m%d-%H%M`"
exec &> >(tee -a "$logfile") exec &> >(tee -a "$logfile")
echo "Updating eole" echo "Updating eole"
Maj-Auto safe_run Maj-Auto
echo "Generating containers" echo "Generating containers"
gen_conteneurs safe_run gen_conteneurs
echo "Generation de la configuration initiale" echo "Generating initial config"
gen_config safe_run gen_config
echo "Instanciating server" echo "Instanciating server"
instance safe_run instance
echo "Running diagnostic" echo "Running diagnostic"
diagnose -L safe_run diagnose -L
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment