зеркало из https://github.com/telerik/docs-seed.git
34 строки
571 B
Bash
34 строки
571 B
Bash
#!/bin/bash
|
|
set -e
|
|
|
|
PID=0
|
|
sigterm_handler() {
|
|
echo "Caught SIGTERM signal! Shutting down..."
|
|
if [ $PID -ne 0 ]; then
|
|
kill -SIGTERM "$PID"
|
|
wait "$PID"
|
|
fi
|
|
exit 143; # 128 + 15 -- SIGTERM
|
|
}
|
|
|
|
sigint_handler() {
|
|
echo "Caught SIGINT signal! Shutting down..."
|
|
if [ $PID -ne 0 ]; then
|
|
kill -SIGTERM "$PID"
|
|
wait "$PID"
|
|
fi
|
|
exit 130; # 128 + 2 -- SIGINT
|
|
}
|
|
|
|
trap 'kill ${!}; sigterm_handler' SIGTERM
|
|
trap 'sigint_handler' SIGINT
|
|
|
|
echo "Initialize watching..."
|
|
cd docs-watcher
|
|
npm install && node index.js & PID="$!"
|
|
|
|
while true
|
|
do
|
|
tail -f /dev/null & wait ${!}
|
|
done
|