<commit_before>#!/usr/bin/env bash


projdir=$(pwd)
pidfile="$projdir/gunicorn.pid"


function stop() {
    if [ -r "${pidfile}" ]; then
        pid=$(cat ${pidfile}) || return 1
        kill ${pid} || return 1
    fi

    return 0
}

function start() {
    gunicorn project.wsgi:application --config gunicorn.py
    sleep 1
}

function status() {
    if [ -r "${pidfile}" ]; then
        return 0
    fi

    return 1
}

if [ "$1" == "start" ]; then
    if status; then
        echo "server already started"
        exit 1
    fi

    start && echo "server started" || echo "server failed to start"

elif [ "$1" == "stop" ]; then
    if ! status; then
        echo "server not running"
        exit 1
    fi

    stop && echo "server stopped" || echo "server failed to stop"

elif  [ "$1" == "restart" ]; then
    if status; then
        stop && echo "server stopped"
    fi

    start && echo "server started"

elif [ "$1" == "status" ]; then
    if status; then
        echo "server running"
        exit 0
<commit_msg>Refactor deploy script script<commit_after>#!/usr/bin/env bash


projdir=$(pwd)
venv="$(dirname ${projdir})/Envs/myquotes"
pidfile="${projdir}/gunicorn.pid"

source ${venv}/bin/activate

function stop() {
    if [ -r "${pidfile}" ]; then
        pid=$(cat ${pidfile}) || return 1
        rm ${pidfile}
        kill -9 ${pid} || return 1
    fi

    return 0
}

function start() {
    gunicorn project.wsgi:application --config gunicorn.py
}

function status() {
    if [ -r "${pidfile}" ]; then
        kill -0 $(cat ${pidfile}) &>/dev/null && return 0
    fi

    return 1;
}

if [ "$1" == "start" ]; then
    if status; then
        echo "server already started"
        exit 1
    fi

    start && echo "server started" || echo "server failed to start"

elif [ "$1" == "stop" ]; then
    if ! status; then
        echo "server not running"
        exit 1
    fi

    stop && echo "server stopped" || echo "server failed to stop"

elif  [ "$1" == "restart" ]; then
    if status; then
        stop && echo "server stopped"
    fi

    start && echo "server started"

elif [ "$1" == "status" ]; then
    if status; then
        echo "server running"
        exit 0

{'fraction_non_alphanumeric': 0.14625228519195613, 'fraction_numerical': 0.012340036563071298, 'mean_word_length': 2.242962962962963, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 4, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, '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': '160053', 'n_tokens_mistral': 739, 'n_tokens_neox': 690, 'n_words': 241}