3
3
# ### Author: SAS Institute Inc. ####
4
4
# ###################################################################
5
5
#
6
- # Copyright (c) 2019-2021 , SAS Institute Inc., Cary, NC, USA. All Rights Reserved.
6
+ # Copyright (c) 2019-2022 , SAS Institute Inc., Cary, NC, USA. All Rights Reserved.
7
7
# SPDX-License-Identifier: Apache-2.0
8
8
#
9
9
#
@@ -91,7 +91,6 @@ do_ps_common()
91
91
92
92
for p in $LIST
93
93
do
94
- # echo "viyasvs: $ACTION $p"
95
94
if [[ $p =~ -a ll-services ]]; then
96
95
/etc/init.d/$p $ACTION &
97
96
else
@@ -408,7 +407,9 @@ checkspace()
408
407
409
408
clean_dbps ()
410
409
{
411
- local LIST=$( ps -e -o " user pid ppid cmd" | grep -E ' sds_consul_health_check|sas-crypto-management' | grep -v grep)
410
+ local LIST=$( ps -e -o " user pid ppid cmd" | \
411
+ grep -E ' sds_consul_health_check|sas-crypto-management|sds_load_config_service_kv_definition|sas-configuration-cli' | \
412
+ grep -v grep | awk ' BEGIN{OFS=" "} { print $1, $2, $4, $5}' )
412
413
do_cleanps " $LIST "
413
414
}
414
415
@@ -427,9 +428,11 @@ do_cleanps()
427
428
local flag
428
429
local NLIST
429
430
local LIST=$*
431
+
430
432
if [[ " $LIST " == " " ]]; then
431
- return
433
+ return 0
432
434
fi
435
+
433
436
if [[ " $1 " == " -s" ]]; then
434
437
flag=$1
435
438
shift
@@ -442,13 +445,15 @@ do_cleanps()
442
445
NLIST=$( echo " $LIST " | awk ' {printf "%s ",$2}' )
443
446
fi
444
447
448
+ if [[ " $NLIST " == " " ]]; then
449
+ return 0
450
+ fi
451
+
445
452
for p in $NLIST
446
453
do
447
- if [[ " $flag " == " " ]]; then
448
- echo " kill -KILL $p "
449
- fi
450
454
ps -p $p > /dev/null
451
455
if [[ $? == 0 ]]; then
456
+ pkill -P $p 2> /dev/null
452
457
kill -KILL $p 2> /dev/null
453
458
fi
454
459
done
@@ -634,12 +639,10 @@ init()
634
639
if [[ -f " $SVCFILE " ]]; then
635
640
IGNORE=$( sed -e ' s/#.*$//' -e ' /^$/d' $SVCFILE )
636
641
fi
637
-
638
642
}
639
643
# #####
640
644
# main
641
645
# #####
642
-
643
646
OPT=$1
644
647
init
645
648
@@ -709,11 +712,14 @@ case "$OPT" in
709
712
fi
710
713
;;
711
714
cleanps)
712
- LIST=$( ps -e -o " user pid ppid cmd" | grep -E ' /opt/sas/spre/|/opt/sas/viya/' | grep -v -E ' grep|pgpool|postgres' )
715
+ shift 1
716
+ DLIST=$*
717
+ LIST=$( echo " $DLIST " | sed -e " { s/[][]//g ; s/\,/\n/g ; s/'//g }" | awk ' {print $1 " " $2}' )
713
718
do_cleanps " $LIST "
714
719
;;
715
720
cleancomp)
716
- LIST=$( ps -e -o " user pid ppid cmd" | grep -E ' /opt/sas/spre/|/opt/sas/viya/' | grep compsrv| grep -v grep)
721
+ LIST=$( ps -e -o " user pid ppid cmd" | grep -E ' /opt/sas/spre/|/opt/sas/viya/' | grep -v grep | \
722
+ awk ' BEGIN{OFS=" "} { print $1, $2, $4, $5}' | grep -E ' launcher|compsrv' )
717
723
do_cleanps " $LIST "
718
724
;;
719
725
checkspace)
@@ -727,7 +733,8 @@ case "$OPT" in
727
733
shift 1
728
734
CNT=$*
729
735
if [[ $CNT -eq 0 ]]; then
730
- ps -ef| grep -E ' /opt/sas/spre/|/opt/sas/viya/|pgpool|postgres' | grep -v grep| awk ' {print}'
736
+ info=$( ps -ef| grep -E ' /opt/sas/spre/|/opt/sas/viya/|pgpool|postgres' | grep -v grep| awk ' {print}' )
737
+ echo " $info "
731
738
else
732
739
info=$( ps -ef| grep -E ' /opt/sas/spre/|/opt/sas/viya/|pgpool|postgres' | grep -v grep)
733
740
if [[ " $info " == " " ]]; then
0 commit comments