#!/bin/sh # chkconfig: 2345 90 10 # description: unicorn system status NAME="unicorn" ENV="production" ROOT_DIR="/var/www/xxxxxxx/current" PID="/var/www/xxxxxxxxx/shared/tmp/pids/unicorn.pid" CONF="/var/www/xxxxxxxx/current/config/unicorn/production.rb" CMD="/opt/rbenv/shims/bundle exec unicorn -c ${CONF} -E ${ENV} -D" start() { if [ -e ${PID} ]; then echo "${NAME} already started" exit 1 fi echo "start ${NAME}" cd ${ROOT_DIR} ${CMD} } stop() { if [ ! -e ${PID} ]; then echo "${NAME} not started" exit 1 fi echo "stop ${NAME}" kill -QUIT $(cat ${PID}) rm -f ${PID} } force_stop() { if [ ! -e ${PID} ]; then echo "${NAME} not started" exit 1 fi echo "stop ${NAME}" kill -INT $(cat ${PID}) rm -f ${PID} } reload() { if [ ! -e ${PID} ]; then echo "${NAME} not started" start exit 0 fi echo "reload ${NAME}" kill -HUP $(cat ${PID}) } restart() { stop start } status() { if [ -e ${PID} ] then echo -n "${NAME} is running: " else echo -n "${NAME} is not running: " fi echo } case "$1" in start) start ;; stop) stop ;; force-stop) force_stop ;; reload) reload ;; restart) restart ;; status) status ;; *) echo "Usage: $0 {start|stop|force-stop|reload|restart|status}" ;; esac
Was this helpful?
0 / 0
1989年生まれのLancers SRE。 ホスティングから大規模なアドテクなどのインフラエンジニアとして携わり、AnsibleやTerraformでのインフラコード化を推進。副業では数社サーバー保守、未経験によるエンジニアのメンターなども実施している。また、「脆弱性スキャナVuls」のOSS活動もしており、自称エバンジェリスト/技術広報/テクニカルサポート/コントリビュータでもある。現在はサービスの信頼性向上、可用性、レイテンシ、パフォーマンス、モニタリング、緊急対応、インフラコード化、リファクタリング、セキュリティ強化、新技術の検証、Docker開発環境の提供、AWSでのインフラ構築、グループ会社のインフラをECS/Fargateへ移行、CakePHP4での管理画面作成、メンター、分析基盤の運用を担当している。