1 Star 0 Fork 1

小春/judeg0-api

Create your Gitee Account
Explore and code with more than 14 million developers,Free private repositories !:)
Sign up
文件
Clone or Download
workers 696 Bytes
Copy Edit Raw Blame History
Herman Zvonimir Došilović authored 2020-04-23 08:27 +08:00 . Refactor scripts.
#!/bin/bash
# Script for running Judge0 API workers.
#
# Usage: ./scripts/workers
#
source ./scripts/load-config
run_resque=1
resque_pid=0
date_now() {
echo -n $(date +"%Y-%m-%d-%H-%M-%S")
}
exit_gracefully() {
echo "[$(date_now)] Killing workers."
run_resque=0
kill -SIGQUIT $(pgrep -P $resque_pid)
kill -SIGTERM $resque_pid
}
trap exit_gracefully SIGTERM SIGINT
mkdir -p tmp/pids &> /dev/null
while [[ $run_resque -eq 1 ]]; do
rm -rf tmp/pids/resque.pid &> /dev/null
echo "[$(date_now)] Starting workers."
rails resque:workers &
resque_pid=$!
while ps -p $resque_pid > /dev/null; do sleep 1s; done
echo "[$(date_now)] Workers are stopped."
done
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/wython/api.git
git@gitee.com:wython/api.git
wython
api
judeg0-api
master

Search