update function
This commit is contained in:
parent
5fc6a2cc3b
commit
3e3031ee27
9
Apply/server/1/0.0.0.0.0/run.sh
Normal file
9
Apply/server/1/0.0.0.0.0/run.sh
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
## 0.0.0.0.0 test
|
||||||
|
|
||||||
|
Apply 0 1 "Test true" [[ -f /etc/passwd ]]
|
||||||
|
Apply 0 2 "Test false" [[ -f /etc/nofile ]]
|
||||||
|
Apply 0 3 "Test" [[ -d /etc ]]
|
||||||
|
|
||||||
|
|
||||||
@ -2,4 +2,6 @@
|
|||||||
|
|
||||||
## 1.1.1.1 Ensure cramfs kernel module is not available (Automated)
|
## 1.1.1.1 Ensure cramfs kernel module is not available (Automated)
|
||||||
|
|
||||||
echo '/bin/true' > /etc/modprobe.d/cramfs.conf
|
Apply 1 1 "cramfs" echo '/bin/true' > /etc/modprobe.d/cramfs.conf
|
||||||
|
Apply 0 2 "cramfs" echo "tout va bien"
|
||||||
|
|
||||||
|
|||||||
@ -2,6 +2,7 @@
|
|||||||
DirFct=$(realpath $(dirname $0))/$(echo $(basename $0)| sed 's/.sh/.d/g')/
|
DirFct=$(realpath $(dirname $0))/$(echo $(basename $0)| sed 's/.sh/.d/g')/
|
||||||
DirCheck=$(realpath $(dirname $0))/Check
|
DirCheck=$(realpath $(dirname $0))/Check
|
||||||
DirApply=$(realpath $(dirname $0))/Apply
|
DirApply=$(realpath $(dirname $0))/Apply
|
||||||
#Debug='-x'
|
Debug='-x'
|
||||||
Debug=""
|
#Debug=""
|
||||||
|
|
||||||
LogDir=/var/log/$(echo $(basename $0) |sed 's/.sh//g')/$(date +%H%m%d%H%M%S)
|
LogDir=/var/log/$(echo $(basename $0) |sed 's/.sh//g')/$(date +%H%m%d%H%M%S)
|
||||||
|
|||||||
@ -0,0 +1,23 @@
|
|||||||
|
function Apply(){
|
||||||
|
ExitError=$1
|
||||||
|
shift
|
||||||
|
Step=$1
|
||||||
|
shift
|
||||||
|
Txt=$1
|
||||||
|
shift
|
||||||
|
Cmd=$@
|
||||||
|
eval $@
|
||||||
|
GetRes=$?
|
||||||
|
if [[ $GetRes -ne 0 ]] && [[ ExitError -eq 1 ]]
|
||||||
|
then
|
||||||
|
echo "Fatal Error on step ${Step} : $Cmd"
|
||||||
|
exit 10
|
||||||
|
else
|
||||||
|
[[ $GetRes -ne 0 ]] && echo "WARNING on step ${Step}" || true
|
||||||
|
fi
|
||||||
|
|
||||||
|
}
|
||||||
|
# Export de la fonction pour être pris en compte dans les sous shell
|
||||||
|
|
||||||
|
export -f Apply
|
||||||
|
|
||||||
@ -3,7 +3,6 @@ function Check(){
|
|||||||
if [[ $1 -ne 0 ]]
|
if [[ $1 -ne 0 ]]
|
||||||
then
|
then
|
||||||
CheckRes=1
|
CheckRes=1
|
||||||
return 1
|
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
export -f Check
|
export -f Check
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user