#!/bin/bash # 更新代码 su -c "cd /code && git pull || git reset --hard FETCH_HEAD" -s /bin/bash - www-data su -c "cd /code && git checkout $PROGINN_BRANCH" -s /bin/bash - www-data cd /code && current_git_branch_latest_id=`git rev-parse HEAD` current_git_branch_last_id=`cat /data/.proginn-commit-id` if [[ "$current_git_branch_latest_id" != "$current_git_branch_last_id" ]]; then echo "$current_git_branch_latest_id" > /data/.proginn-commit-id # 同步crontab cronfile=/code/config/php7/web/cron.test cp $cronfile /etc/crontab echo "*/2 * * * * root bash /data/docker/shell/script-code-update.sh\n" >> /etc/crontab # 启动定时脚本 service cron restart # 队列 ps axu |grep resque.php | awk '{print $2}'|xargs kill -15 ps axu |grep resque.php | awk '{print $2}'|xargs kill -9 for (( i = 0; i < 5; i++ )); do su -c "QUEUE=highest,high,default,low,lowest COUNT=1 nohup php /code/web/bin/resque.php &" -s /bin/bash - www-data done fi