Skip to content

Commit

Permalink
Merge pull request #101 from sassoftware/develop
Browse files Browse the repository at this point in the history
merge develop to main for release
  • Loading branch information
kevinlinglesas authored Aug 2, 2023
2 parents 8eab36e + 2edd822 commit f299ad6
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 14 deletions.
4 changes: 2 additions & 2 deletions playbooks/viya-mmsu/viya-services-stop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#### Author: SAS Institute Inc. ####
####################################################################
#
# Copyright (c) 2019-2021, SAS Institute Inc., Cary, NC, USA. All Rights Reserved.
# Copyright (c) 2019-2022, SAS Institute Inc., Cary, NC, USA. All Rights Reserved.
# SPDX-License-Identifier: Apache-2.0
#
---
Expand Down Expand Up @@ -262,7 +262,7 @@
when: (stray_processes.stdout != '') and (enable_stray_cleanup|bool != true)

- name: Clean up SAS stray processes if enabled
script: viya-svs.sh cleanps
script: viya-svs.sh cleanps "{{stray_processes.stdout_lines}}"
when: (enable_stray_cleanup|bool == true) and (stray_processes.stdout != '')
check_mode: no
any_errors_fatal: true
Expand Down
31 changes: 19 additions & 12 deletions playbooks/viya-mmsu/viya-svs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#### Author: SAS Institute Inc. ####
####################################################################
#
# Copyright (c) 2019-2021, SAS Institute Inc., Cary, NC, USA. All Rights Reserved.
# Copyright (c) 2019-2022, SAS Institute Inc., Cary, NC, USA. All Rights Reserved.
# SPDX-License-Identifier: Apache-2.0
#
#
Expand Down Expand Up @@ -91,7 +91,6 @@ do_ps_common()

for p in $LIST
do
#echo "viyasvs: $ACTION $p"
if [[ $p =~ -all-services ]]; then
/etc/init.d/$p $ACTION &
else
Expand Down Expand Up @@ -408,7 +407,9 @@ checkspace()

clean_dbps()
{
local LIST=$(ps -e -o "user pid ppid cmd" |grep -E 'sds_consul_health_check|sas-crypto-management'|grep -v grep)
local LIST=$(ps -e -o "user pid ppid cmd"|\
grep -E 'sds_consul_health_check|sas-crypto-management|sds_load_config_service_kv_definition|sas-configuration-cli'|\
grep -v grep |awk 'BEGIN{OFS=" "} { print $1, $2, $4, $5}')
do_cleanps "$LIST"
}

Expand All @@ -427,9 +428,11 @@ do_cleanps()
local flag
local NLIST
local LIST=$*

if [[ "$LIST" == "" ]]; then
return
return 0
fi

if [[ "$1" == "-s" ]]; then
flag=$1
shift
Expand All @@ -442,13 +445,15 @@ do_cleanps()
NLIST=$(echo "$LIST"|awk '{printf "%s ",$2}')
fi

if [[ "$NLIST" == "" ]]; then
return 0
fi

for p in $NLIST
do
if [[ "$flag" == "" ]]; then
echo "kill -KILL $p"
fi
ps -p $p > /dev/null
if [[ $? == 0 ]]; then
pkill -P $p 2>/dev/null
kill -KILL $p 2>/dev/null
fi
done
Expand Down Expand Up @@ -634,12 +639,10 @@ init()
if [[ -f "$SVCFILE" ]]; then
IGNORE=$(sed -e 's/#.*$//' -e '/^$/d' $SVCFILE)
fi

}
######
# main
######

OPT=$1
init

Expand Down Expand Up @@ -709,11 +712,14 @@ case "$OPT" in
fi
;;
cleanps)
LIST=$(ps -e -o "user pid ppid cmd"|grep -E '/opt/sas/spre/|/opt/sas/viya/'|grep -v -E 'grep|pgpool|postgres')
shift 1
DLIST=$*
LIST=$(echo "$DLIST" | sed -e "{ s/[][]//g ; s/\,/\n/g ; s/'//g }" | awk '{print $1 " " $2}')
do_cleanps "$LIST"
;;
cleancomp)
LIST=$(ps -e -o "user pid ppid cmd" |grep -E '/opt/sas/spre/|/opt/sas/viya/'|grep compsrv|grep -v grep)
LIST=$(ps -e -o "user pid ppid cmd"|grep -E '/opt/sas/spre/|/opt/sas/viya/'|grep -v grep |\
awk 'BEGIN{OFS=" "} { print $1, $2, $4, $5}'| grep -E 'launcher|compsrv')
do_cleanps "$LIST"
;;
checkspace)
Expand All @@ -727,7 +733,8 @@ case "$OPT" in
shift 1
CNT=$*
if [[ $CNT -eq 0 ]]; then
ps -ef|grep -E '/opt/sas/spre/|/opt/sas/viya/|pgpool|postgres'|grep -v grep|awk '{print}'
info=$(ps -ef|grep -E '/opt/sas/spre/|/opt/sas/viya/|pgpool|postgres'|grep -v grep|awk '{print}')
echo "$info"
else
info=$(ps -ef|grep -E '/opt/sas/spre/|/opt/sas/viya/|pgpool|postgres'|grep -v grep)
if [[ "$info" == "" ]]; then
Expand Down

0 comments on commit f299ad6

Please sign in to comment.