Commit 4132345e authored by Dominika Liberda's avatar Dominika Liberda 💽

Added workers

parent 0c44c92d
# app config - loaded on server bootup
# this example file will get overwritten with application-specific config
# worker_add <worker> <interval>
# ---
# worker_add example 5
\ No newline at end of file
......@@ -6,6 +6,12 @@ function ctrl_c() {
echo -e "Killed all remaining processes.\nHave a great day!!"
}
source src/worker.sh
if [[ -f "config/app.sh" ]]; then
source config/app.sh
fi
source config/master.sh
echo "HTTP.sh"
......
#!/bin/bash
# worker.sh - setup and control of workers
# worker_add(name, interval)
function worker_add() {
if [[ -x "workers/$1/worker.sh" ]]; then
while true; do workers/$1/worker.sh; sleep $2; if [[ $(cat workers/$1/control) == "die" ]]; then echo "" > workers/$1/control; while true; do if [[ $(cat workers/$1/control) == "run" ]]; then echo "" > workers/$1/control; break; fi; sleep $2; done; fi; done &
else
echo "You have a broken worker configuration! Please check if worker.sh in worker $1 is executable."
fi
}
# worker_kill(name)
function worker_kill() {
echo "die" > workers/$1/control
}
# worker_resume(name)
function worker_resume() {
echo "run" > workers/$i/control
}
\ No newline at end of file
#!/bin/bash
date
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment