<commit_before>#!/bin/bash

set -e

if [ "$1" = 'zammad' ]; then

    # starting services
    service postgresql start
    service elasticsearch start
    service postfix start
    service nginx start

    cd ${ZAMMAD_DIR}
    echo "starting zammad...."
    su -c "bundle exec script/websocket-server.rb -b 0.0.0.0 start &>> ${ZAMMAD_DIR}/log/zammad.log &" zammad
    su -c "bundle exec script/scheduler.rb start &>> ${ZAMMAD_DIR}/log/zammad.log &" zammad

    if [ "${RAILS_SERVER}" == "puma" ]; then
	su -c "bundle exec puma -b tcp://0.0.0.0:3000 -e ${RAILS_ENV} &>> ${ZAMMAD_DIR}/log/zammad.log &" zammad
    elif [ "${RAILS_SERVER}" == "unicorn" ]; then
	su -c "bundle exec unicorn -p 3000 -c config/unicorn.rb -E ${RAILS_ENV} &>> ${ZAMMAD_DIR}/log/zammad.log &" zammad
    fi

    until curl -GET localhost:3000 &> /dev/null; do
	echo "waiting for zammad to be ready..."
	sleep 2
    done

    # show url
    echo -e "\nZammad is ready! Visit http://localhost in your browser!"
    echo -e "If you like to use Zammad from somewhere else edit servername directive in /etc/nginx/sites-enabled/zammad.conf!\n"

    # run shell
    /bin/bash

fi<commit_msg>added loop to wait for postgresql to be ready<commit_after>#!/bin/bash

set -e

if [ "$1" = 'zammad' ]; then

    # starting services
    service postgresql start
    service elasticsearch start
    service postfix start
    service nginx start

    cd ${ZAMMAD_DIR}
    echo "starting zammad...."
    su -c "bundle exec script/websocket-server.rb -b 0.0.0.0 start &>> ${ZAMMAD_DIR}/log/zammad.log &" zammad
    su -c "bundle exec script/scheduler.rb start &>> ${ZAMMAD_DIR}/log/zammad.log &" zammad

    if [ "${RAILS_SERVER}" == "puma" ]; then
	su -c "bundle exec puma -b tcp://0.0.0.0:3000 -e ${RAILS_ENV} &>> ${ZAMMAD_DIR}/log/zammad.log &" zammad
    elif [ "${RAILS_SERVER}" == "unicorn" ]; then
	su -c "bundle exec unicorn -p 3000 -c config/unicorn.rb -E ${RAILS_ENV} &>> ${ZAMMAD_DIR}/log/zammad.log &" zammad
    fi

    # wait for all postgres /& zammad processes coming up
    until su - postgres -c 'psql -c "select version()"' &> /dev/null; do
	echo "waiting for postgres to be ready..."
	sleep 2
    done

    until curl -GET localhost:3000 &> /dev/null; do
	echo "waiting for zammad to be ready..."
	sleep 2
    done

    # show url
    echo -e "\nZammad is ready! Visit http://localhost in your browser!"
    echo -e "If you like to use Zammad from somewhere else edit servername directive in /etc/nginx/sites-enabled/zammad.conf!\n"

    # run shell
    /bin/bash

fi
{'fraction_non_alphanumeric': 0.14083398898505115, 'fraction_numerical': 0.01770259638080252, 'mean_word_length': 2.847201210287443, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 22, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 4, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2985691', 'n_tokens_mistral': 997, 'n_tokens_neox': 906, 'n_words': 285}