fix: kill watcher function [skip ci]

This commit is contained in:
Nicolas Meienberger 2022-11-01 08:58:53 +01:00
parent 30bcb47c0a
commit 93188b662c
3 changed files with 5 additions and 9 deletions

View file

@ -54,7 +54,7 @@ function ensure_linux() {
function clean_logs() {
# Clean logs folder
logs_folder="${ROOT_FOLDER}/logs"
local logs_folder="${ROOT_FOLDER}/logs"
# Create the folder if it doesn't exist
if [[ ! -d "${logs_folder}" ]]; then
@ -64,7 +64,7 @@ function clean_logs() {
if [ "$(find "${logs_folder}" -maxdepth 1 -type f | wc -l)" -gt 0 ]; then
echo "Cleaning logs folder..."
files=($(ls -d "${logs_folder}"/* | xargs -n 1 basename | sed 's/\///g'))
local files=($(ls -d "${logs_folder}"/* | xargs -n 1 basename | sed 's/\///g'))
for file in "${files[@]}"; do
echo "Removing ${file}"
@ -74,7 +74,7 @@ function clean_logs() {
}
function kill_watcher() {
watcher_pid="$(ps aux | grep "scripts/watcher" | grep -v grep | awk '{print $2}')"
local watcher_pid="$(ps aux | grep "scripts/watcher" | grep -v grep | awk '{print $2}')"
# kill it if it's running
if [[ -n $watcher_pid ]]; then

View file

@ -16,7 +16,7 @@ export COMPOSE_HTTP_TIMEOUT=240
# Stop all installed apps if there are any
apps_folder="${ROOT_FOLDER}/apps"
if [ "$(find "${apps_folder}" -maxdepth 1 -type d | wc -l)" -gt 1 ]; then
apps_names=($(ls -d ${apps_folder}/*/ | xargs -n 1 basename | sed 's/\///g'))
apps_names=($(ls -d "${apps_folder}"/*/ | xargs -n 1 basename | sed 's/\///g'))
for app_name in "${apps_names[@]}"; do
# if folder ${ROOT_FOLDER}/app-data/app_name exists, then stop app
@ -29,6 +29,7 @@ else
echo "No app installed that can be stopped."
fi
kill_watcher
echo "Stopping Docker services..."
echo
docker compose down --remove-orphans --rmi local

View file

@ -6,8 +6,6 @@ ROOT_FOLDER="${PWD}"
WATCH_FILE="${ROOT_FOLDER}/state/events"
function clean_events() {
echo "Cleaning events..."
# Create the file if it doesn't exist
if [[ ! -f "${WATCH_FILE}" ]]; then
touch "${WATCH_FILE}"
@ -43,8 +41,6 @@ function run_command() {
local result=$?
echo "Command ${command_path} exited with code ${result}"
if [[ $result -eq 0 ]]; then
set_status "$id" "success"
else
@ -105,7 +101,6 @@ function select_command() {
return 0
fi
echo "Unknown command ${command}"
return 0
}