<commit_before>#! /bin/sh

NAME=$1
DIR=$2
FILE="$NAME-app.js"

get_pid() {
    pid=`ps -ef | sed -n '/node .*'"$FILE"'/{/grep/!p;}' | awk '{print$2}'`;
    echo "$pid";
}

case $3 in
"start")
    pid=$(get_pid);
    if [ -z $pid ]
    then
        cd $DIR
        echo "Starting $NAME in $4 environment at $DIR."
        ENV=$4 nohup node $DIR/$FILE > $DIR/nohup.out 2> $DIR/nohup.err < /dev/null &
        pid=$(get_pid)
        echo "$NAME is running on pid $pid."
    else
        echo "$NAME is already running on pid $pid."
    fi;;
"status")
    pid=$(get_pid);
    if [ -z $pid ]
    then
        echo "$NAME is not running."
    else
        echo "$NAME is running on pid $pid."
    fi;;
"stop")
    pid=$(get_pid);
    if [ -z $pid ]
    then
        echo "$NAME is not running."
    else
        echo "Stopping $NAME on pid $pid."
        kill -9 "$pid"
    fi;;
*)
    echo "Usage:\n\t$0 NAME DIR <start|stop|status> ENV";;
esac<commit_msg>Renamed env var to NODE_ENV as per express 2.x doco.<commit_after>#! /bin/sh

NAME=$1
DIR=$2
FILE="$NAME-app.js"

get_pid() {
    pid=`ps -ef | sed -n '/node .*'"$FILE"'/{/grep/!p;}' | awk '{print$2}'`;
    echo "$pid";
}

case $3 in
"start")
    pid=$(get_pid);
    if [ -z $pid ]
    then
        cd $DIR
        echo "Starting $NAME in $4 environment at $DIR."
        NODE_ENV=$4 nohup node $DIR/$FILE > $DIR/nohup.out 2> $DIR/nohup.err < /dev/null &
        pid=$(get_pid)
        echo "$NAME is running on pid $pid."
    else
        echo "$NAME is already running on pid $pid."
    fi;;
"status")
    pid=$(get_pid);
    if [ -z $pid ]
    then
        echo "$NAME is not running."
    else
        echo "$NAME is running on pid $pid."
    fi;;
"stop")
    pid=$(get_pid);
    if [ -z $pid ]
    then
        echo "$NAME is not running."
    else
        echo "Stopping $NAME on pid $pid."
        kill -9 "$pid"
    fi;;
*)
    echo "Usage:\n\t$0 NAME DIR <start|stop|status> ENV";;
esac
{'fraction_non_alphanumeric': 0.1778006166495375, 'fraction_numerical': 0.009763617677286743, 'mean_word_length': 2.013931888544892, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 9, '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': '7097106', 'n_tokens_mistral': 743, 'n_tokens_neox': 728, 'n_words': 228}