1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52
|
#!@BASH@
set -x
REPO_PATH="$(realpath "$(dirname "$0")"/../)"
systemctl is-active --quiet pcsd
PCSD_INITIALLY_RUNNING=$?
if [ $PCSD_INITIALLY_RUNNING -eq 0 ]; then
echo "* stopping pcsd service..."
systemctl stop pcsd
fi
# export PCSD_SSL_OPTIONS=${PCSD_SSL_OPTIONS:='OP_NO_SSLv2,OP_NO_SSLv3,OP_NO_TLSv1,OP_NO_TLSv1_1'}
# export PCSD_SSL_CIPHERS=${PCSD_SSL_CIPHERS:='DEFAULT:!RC4:!3DES:@STRENGTH'}
# export PCSD_BIND_ADDR=${PCSD_BIND_ADDR:='::'}
# export PCSD_PORT=${PCSD_PORT:=2224}
# export PCSD_SESSION_LIFETIME=$PCSD_SESSION_LIFETIME:=36a00}
# export PCSD_WORKER_COUNT=1
# export PCSD_WORKER_RESET_LIMIT=2
export PCSD_DEBUG="${PCSD_DEBUG:=true}"
export PCSD_DEV="${PCSD_DEV:=true}"
export GEM_HOME="$REPO_PATH/@PCSD_BUNDLED_DIR_ROOT_LOCAL@"
# export GEM_PATH="$GEM_HOME:"`gem env gempath`
# RACK_ENV=production ruby -I${REPO_PATH}/pcsd ${REPO_PATH}/pcsd/pcsd.service-runner &
RACK_ENV=production ruby "-I${REPO_PATH}/pcsd" "${REPO_PATH}/pcsd/pcsd" &
pid_ruby=$!
echo "* ruby daemon started: $pid_ruby"
sleep 5
"${REPO_PATH}/pcs/pcs" -d &
pid_python=$!
echo "* python daemon started: $pid_python"
tail -f "@LOCALSTATEDIR@/log/pcsd/pcsd.log" &
pid_tail=$!
got_signal() {
echo "* killing $pid_tail $pid_python $pid_ruby"
kill $pid_tail
kill $pid_python
kill $pid_ruby
sleep 5
}
trap 'got_signal' INT
echo "* ready to provide services, ctrl+c to exit..."
wait
if [ $PCSD_INITIALLY_RUNNING -eq 0 ]; then
echo "* starting pcsd service..."
systemctl start pcsd
fi
|