[fix] kill -> stop, add indent to service check, revert incorrect logic

This commit is contained in:
William Wernert
2020-12-03 10:31:45 -05:00
parent 76fff28dfa
commit 2c208ec943
2 changed files with 8 additions and 8 deletions

View File

@@ -259,10 +259,10 @@ check_service_status() {
systemctl status $service_name > /dev/null 2>&1
local status=$?
if [ $status -gt 0 ]; then
echo "$service_name is not running" >> "$setup_log" 2>&1
echo " $service_name is not running" >> "$setup_log" 2>&1
return 1;
else
echo "$service_name is running" >> "$setup_log" 2>&1
echo " $service_name is running" >> "$setup_log" 2>&1
return 0;
fi
@@ -1400,11 +1400,11 @@ reinstall_init() {
# Kill any salt processes (safely)
for service in "${salt_services[@]}"; do
# Stop the service in the background so we can exit after a certain amount of time
systemctl kill "$service" &
systemctl stop "$service" &
local pid=$!
local count=0
while ! (check_service_status "$service"); do
while check_service_status "$service"; do
if [[ $count -gt $service_retry_count ]]; then
echo "Could not stop $service after 1 minute, exiting setup."