<commit_before>#!/bin/sh  
# Program to operate Rails with Unicorn 

PORT=$(test -z "$2" && echo "4001" || echo "$2") # default 4001
ENVIRONMENT=$(test -z "$3" && echo "production" || echo "$3") # default production
UNICORN=unicorn  
CONFIG_FILE=config/unicorn.rb  
APP_ROOT_PATH=$(pwd)

# user bash environment for crontab job.
source ~/.bash_profile
source ~/.bashrc
# maybe enter other dir after source.
cd ${APP_ROOT_PATH}

case "$1" in  
    precompile)
        RAILS_ENV=production bundle exec rake assets:clean
        RAILS_ENV=production bundle exec rake assets:my_precompile
        ;;
    bundle)
        echo "## bundle install"
        bundle install --local > /dev/null 2>&1 
        if test $? -eq 0 
        then
          echo -e "\t bundle install --local successfully."
        else
          bundle install
        fi
        ;;
    start)  
        /bin/sh unicorn.sh bundle

        test -d log || mkdir log
        test -d tmp || mkdir -p tmp/pids

        echo "## release cache/buffer."
        sync && echo 3 > /proc/sys/vm/drop_caches > /dev/null 2>&1
        echo -e "\t release cache/buffer $(test $? -eq 0 && echo "successfully" || echo "failed")."

        echo "## rake tasks"
        TASK1="bundle exec rake tmp:clear"
        `${TASK1}`
        echo -e "\t ${TASK1} $(test $? -eq 0 && echo "successfully" || echo "failed")."
        TASK2="bundle exec rake assets:clobber"
        `${TASK2} > /dev/null 2>&1`
        echo -e "\t ${TASK2} $(test $? -eq 0 && echo "successfully" || echo "failed")."
        TASK3="bundle exec rake assets:my_precompile"
        `${TASK3} > /dev/null 2>&1`
        echo -e "\t ${TASK3} $(test $? -eq 0 && echo "successfully" || echo "failed")."

        echo "## start unicorn"
        echo -e "\t port: ${PORT} \n\t environment: ${ENVIRONMENT}"
        bundle exec ${UNICORN} -c ${CONFIG_FILE} -p ${PORT} -E ${ENVIRONMENT} -D > /dev/null 2>&1
        echo -e "\t unicorn start $(test $? -eq 0 && echo "successfully" || echo "failed")."
        ;;  
    stop)  
        echo "## stop unicorn"<commit_msg>comment  for user role.<commit_after>#!/bin/sh  
# Program to operate Rails with Unicorn 

PORT=$(test -z "$2" && echo "4001" || echo "$2") # default 4001
ENVIRONMENT=$(test -z "$3" && echo "production" || echo "$3") # default production
UNICORN=unicorn  
CONFIG_FILE=config/unicorn.rb  
APP_ROOT_PATH=$(pwd)

# user bash environment for crontab job.
source ~/.bash_profile
source ~/.bashrc
# maybe enter other dir after source.
cd ${APP_ROOT_PATH}

case "$1" in  
    precompile)
        RAILS_ENV=production bundle exec rake assets:clean
        RAILS_ENV=production bundle exec rake assets:my_precompile
        ;;
    bundle)
        echo "## bundle install"
        bundle install --local > /dev/null 2>&1 
        if test $? -eq 0 
        then
          echo -e "\t bundle install --local successfully."
        else
          bundle install
        fi
        ;;
    start)  
        /bin/sh unicorn.sh bundle

        test -d log || mkdir log
        test -d tmp || mkdir -p tmp/pids

        echo "## release cache/buffer."
        #sync && echo 3 > /proc/sys/vm/drop_caches > /dev/null 2>&1
        echo -e "\t release cache/buffer $(test $? -eq 0 && echo "successfully" || echo "failed")."

        echo "## rake tasks"
        TASK1="bundle exec rake tmp:clear"
        `${TASK1}`
        echo -e "\t ${TASK1} $(test $? -eq 0 && echo "successfully" || echo "failed")."
        TASK2="bundle exec rake assets:clobber"
        `${TASK2} > /dev/null 2>&1`
        echo -e "\t ${TASK2} $(test $? -eq 0 && echo "successfully" || echo "failed")."
        TASK3="bundle exec rake assets:my_precompile"
        `${TASK3} > /dev/null 2>&1`
        echo -e "\t ${TASK3} $(test $? -eq 0 && echo "successfully" || echo "failed")."

        echo "## start unicorn"
        echo -e "\t port: ${PORT} \n\t environment: ${ENVIRONMENT}"
        bundle exec ${UNICORN} -c ${CONFIG_FILE} -p ${PORT} -E ${ENVIRONMENT} -D > /dev/null 2>&1
        echo -e "\t unicorn start $(test $? -eq 0 && echo "successfully" || echo "failed")."
        ;;  
    stop)  
        echo "## stop unicorn"
{'fraction_non_alphanumeric': 0.15529298287918977, 'fraction_numerical': 0.018808777429467086, 'mean_word_length': 2.205564142194745, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 25, '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': '1291643', 'n_tokens_mistral': 1434, 'n_tokens_neox': 1363, 'n_words': 432}