+ some logs for workers [WRKR]

This commit is contained in:
Dominika Liberda 2020-10-05 02:23:14 +02:00
parent e84efbc9b0
commit 3e01d1147e
3 changed files with 6 additions and 3 deletions

2
.gitignore vendored Normal file
View file

@ -0,0 +1,2 @@
secret/*
app

View file

@ -46,14 +46,14 @@ LauraIsCute
exit 0 exit 0
fi fi
echo "HTTP.sh"
source src/worker.sh source src/worker.sh
if [[ -f "${cfg[namespace]}/config.sh" ]]; then if [[ -f "${cfg[namespace]}/config.sh" ]]; then
source "${cfg[namespace]}/config.sh" source "${cfg[namespace]}/config.sh"
fi fi
echo "HTTP.sh"
if [[ ${cfg[http]} == true ]]; then if [[ ${cfg[http]} == true ]]; then
echo "[HTTP] listening on ${cfg[ip]}:${cfg[port]}" echo "[HTTP] listening on ${cfg[ip]}:${cfg[port]}"
ncat -v -l ${cfg[ip]} ${cfg[port]} -c ./src/server.sh -k 2>> /dev/null & ncat -v -l ${cfg[ip]} ${cfg[port]} -c ./src/server.sh -k 2>> /dev/null &

View file

@ -5,6 +5,7 @@
# worker_add(name, interval) # worker_add(name, interval)
function worker_add() { function worker_add() {
if [[ -x "${cfg[namespace]}/workers/$1/worker.sh" ]]; then if [[ -x "${cfg[namespace]}/workers/$1/worker.sh" ]]; then
echo "[WRKR] adding worker $1"
while true; do while true; do
source "${cfg[namespace]}/workers/$1/worker.sh" source "${cfg[namespace]}/workers/$1/worker.sh"
sleep $2 sleep $2
@ -20,7 +21,7 @@ function worker_add() {
fi fi
done & done &
else else
echo "You have a broken worker configuration! Please check if worker.sh in worker $1 is executable." echo "[WRKR] Broken config - workers/$1/worker.sh does not exist, or is not executable?"
fi fi
} }