modif function serviceIsEnabled
This commit is contained in:
13
functions.sh
13
functions.sh
@@ -102,9 +102,11 @@ function fileCountPattern {
|
|||||||
file=$1
|
file=$1
|
||||||
shift
|
shift
|
||||||
string=$@
|
string=$@
|
||||||
if [ ! -f $file ] ; then echo -ne "0;" ; return 0 ;fi
|
if [ ! -f $file ] ; then e 0 ; return 0 ;fi
|
||||||
|
local size=$(stat --printf '%s' $file)
|
||||||
|
if [ $size -eq 0 ] ; then e 0 ; return 0 ; fi
|
||||||
num=$(grep -ciE "${string}" $file )
|
num=$(grep -ciE "${string}" $file )
|
||||||
echo -ne "$num;"
|
e "$num"
|
||||||
}
|
}
|
||||||
|
|
||||||
# Ok if file contains N pattern
|
# Ok if file contains N pattern
|
||||||
@@ -213,9 +215,10 @@ function commandStdoutPattern {
|
|||||||
# ok if given service is enabled
|
# ok if given service is enabled
|
||||||
# arg1: service
|
# arg1: service
|
||||||
function serviceIsEnabled {
|
function serviceIsEnabled {
|
||||||
service=$1
|
local root=$1
|
||||||
service=/etc/systemd/system/multi-user.target.wants/${1}.service
|
local service=${2}.service
|
||||||
if [ -h $service ] ; then e 1 ; else e 0 ; fi
|
c=$(ls -l ${root}/etc/systemd/system/multi-user.target.wants/ | grep -i ${service} | wc -l)
|
||||||
|
if [ $c -gt 0 ] ; then e 1 ; else e 0 ; fi
|
||||||
}
|
}
|
||||||
|
|
||||||
# ok if output of given url contains given stuff
|
# ok if output of given url contains given stuff
|
||||||
|
|||||||
Reference in New Issue
Block a user