3 |
# loads client classes from $MCLIBDIR |
# loads client classes from $MCLIBDIR |
4 |
load_client_classes() |
load_client_classes() |
5 |
{ |
{ |
6 |
|
local i |
7 |
|
|
8 |
# client specific |
# client specific |
9 |
for i in ${MCLIBDIR}/include/*.client.class |
for i in $(find ${MCLIBDIR}/include -type f -name \*.client.class) |
10 |
do |
do |
11 |
source ${i} || eecho "error loading ${i}" |
source ${i} || eecho "error loading ${i}" |
12 |
done |
done |
22 |
done |
done |
23 |
} |
} |
24 |
|
|
25 |
|
# stops the whole service via remote cmd |
26 |
|
stop_service() |
27 |
|
{ |
28 |
|
local pid |
29 |
|
for pid in $(pidof sslsvd) |
30 |
|
do |
31 |
|
kill -15 ${pid} |
32 |
|
sleep 1 |
33 |
|
kill -9 ${pid} |
34 |
|
done |
35 |
|
} |
36 |
|
|
37 |
# # import_resource $table $serial $resource $value |
# # import_resource $table $serial $resource $value |
38 |
# import_resource() |
# import_resource() |
39 |
# { |
# { |
98 |
mecho "\tauth - authenticate to the daemon" |
mecho "\tauth - authenticate to the daemon" |
99 |
mecho "\tprovide - shows provides of a system" |
mecho "\tprovide - shows provides of a system" |
100 |
mecho "\trequire - verify plugin requirements" |
mecho "\trequire - verify plugin requirements" |
101 |
|
mecho "\treload - reloads all client classes plugins" |
102 |
|
mecho "\trestart - restarts the daemon" |
103 |
|
mecho "\tstop - stops the daemon" |
104 |
mecho "\tnocolors - disable colors, useful for the webclient" |
mecho "\tnocolors - disable colors, useful for the webclient" |
105 |
|
mecho "\tcolors - enable colors" |
106 |
mecho "\tquiet - do not print any unecessary messages" |
mecho "\tquiet - do not print any unecessary messages" |
107 |
mecho "\thelp - shows help" |
mecho "\thelp - shows help" |
108 |
mecho "\tquit - quits the connection to the server" |
mecho "\tquit - quits the connection to the server" |
267 |
# sort them alpabetically |
# sort them alpabetically |
268 |
sorted=$(for i in ${PROVIDE}; do echo "${i}"; done | sort) |
sorted=$(for i in ${PROVIDE}; do echo "${i}"; done | sort) |
269 |
# do not escape, or CRLFS get printed to screen too |
# do not escape, or CRLFS get printed to screen too |
270 |
rvecho ${sorted} |
rvecho ${sorted} |
271 |
} |
} |
272 |
|
|
273 |
# message only echo | disabled in quiet mode |
# message only echo | disabled in quiet mode |
367 |
# every thing went ok, directory not empty |
# every thing went ok, directory not empty |
368 |
return 0 |
return 0 |
369 |
} |
} |
370 |
|
|
371 |
|
help_daemon_mroot() |
372 |
|
{ |
373 |
|
mecho "get daemon.mroot" |
374 |
|
mecho " Prints current MROOT variable." |
375 |
|
mecho |
376 |
|
mecho "set daemon.mroot [path]" |
377 |
|
mecho " set MROOT variable to given path." |
378 |
|
} |
379 |
|
|
380 |
|
get_daemon_mroot() |
381 |
|
{ |
382 |
|
rvecho "${MROOT}" |
383 |
|
} |
384 |
|
|
385 |
|
set_daemon_mroot() |
386 |
|
{ |
387 |
|
local path=$1 |
388 |
|
|
389 |
|
if [[ -d ${path} ]] |
390 |
|
then |
391 |
|
export MROOT="${path}" |
392 |
|
decho "MROOT='${MROOT}' is set." |
393 |
|
else |
394 |
|
eecho "Path '${path}' does not exist. MROOT not set." |
395 |
|
fi |
396 |
|
} |
397 |
|
|
398 |
|
list_files_in_directory() |
399 |
|
{ |
400 |
|
local i |
401 |
|
local retval |
402 |
|
local path |
403 |
|
local opts |
404 |
|
local type |
405 |
|
|
406 |
|
# basic getops |
407 |
|
for i in $* |
408 |
|
do |
409 |
|
case $1 in |
410 |
|
-mindepth) shift; opts+=" -mindepth $1" ;; |
411 |
|
-maxdepth) shift; opts+=" -maxdepth $1" ;; |
412 |
|
-type) shift; type="$1" ;; |
413 |
|
'') continue ;; |
414 |
|
*) path="$1" ;; |
415 |
|
esac |
416 |
|
shift |
417 |
|
done |
418 |
|
|
419 |
|
if [[ -z ${path} ]] |
420 |
|
then |
421 |
|
eecho "No path given." |
422 |
|
return 1 |
423 |
|
fi |
424 |
|
|
425 |
|
if [[ ! -d ${path} ]] |
426 |
|
then |
427 |
|
eecho "Directory '${path}' does not exist." |
428 |
|
return 1 |
429 |
|
fi |
430 |
|
|
431 |
|
# default to files |
432 |
|
[[ -z ${type} ]] && type=f |
433 |
|
|
434 |
|
for i in $(find ${path} ${opts} -type ${type} | sort) |
435 |
|
do |
436 |
|
if [[ -z ${retval} ]] |
437 |
|
then |
438 |
|
retval="$(basename ${i})" |
439 |
|
else |
440 |
|
retval="${retval} $(basename ${i})" |
441 |
|
fi |
442 |
|
done |
443 |
|
|
444 |
|
rvecho "${retval}" |
445 |
|
} |