modif function serviceIsEnabled
This commit is contained in:
13
functions.sh
13
functions.sh
@@ -102,9 +102,11 @@ function fileCountPattern {
|
||||
file=$1
|
||||
shift
|
||||
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 )
|
||||
echo -ne "$num;"
|
||||
e "$num"
|
||||
}
|
||||
|
||||
# Ok if file contains N pattern
|
||||
@@ -213,9 +215,10 @@ function commandStdoutPattern {
|
||||
# ok if given service is enabled
|
||||
# arg1: service
|
||||
function serviceIsEnabled {
|
||||
service=$1
|
||||
service=/etc/systemd/system/multi-user.target.wants/${1}.service
|
||||
if [ -h $service ] ; then e 1 ; else e 0 ; fi
|
||||
local root=$1
|
||||
local service=${2}.service
|
||||
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
|
||||
|
||||
Reference in New Issue
Block a user