<commit_before>#!/bin/bash

#exit on error
set -e

#Fix folder permissions
sudo chown -R $USERNAME:$USERNAME $HOME;

test ! -f $HOME/resources/$RUNDECK_NODE.ready || rm $HOME/resources/$RUNDECK_NODE.ready

#TODO SACAR
echo "######### start_rundeck on $RUNDECK_NODE ######### "
if test -f $HOME/resources/$RUNDECK_NODE.ready ; then
  echo "Already started, skipping..."
  exit 0
fi

# Some Cleanup
rm -rfv $HOME/server/logs/*
rm -fv $HOME/testdata/*

# Configure general stuff.
# configure hostname, nodename, url


# RUN TEST PRESTART SCRIPT
if [[ ! -z "$CONFIG_SCRIPT_PRESTART" && -f $CONFIG_SCRIPT_PRESTART ]];
then
  . $CONFIG_SCRIPT_PRESTART
else
  echo "### Prestart config not set. skipping..."
fi

export RDECK_BASE=$HOME
LOGFILE=$RDECK_BASE/var/log/service.log
mkdir -p $(dirname $LOGFILE)
FWKPROPS=$HOME/etc/framework.properties
mkdir -p $(dirname $FWKPROPS)

export RUNDECK_PORT=${RUNDECK_PORT:-4440}
export RUNDECK_URL=${RUNDECK_URL:-http://$RUNDECK_NODE:$RUNDECK_PORT}


# if [ -n "$SETUP_SSL" ] ; then
#   export RUNDECK_PORT=4443
#   export RUNDECK_URL=https://$RUNDECK_NODE:$RUNDECK_PORT
# fi

cat > $FWKPROPS <<END
framework.server.name = $RUNDECK_NODE
framework.server.hostname = $RUNDECK_NODE
framework.server.port = $RUNDECK_PORT
framework.server.url = $RUNDECK_URL

# ----------------------------------------------------------------
# Installation locations
# ----------------------------------------------------------------

rdeck.base=$RDECK_BASE

framework.projects.dir=$RDECK_BASE/projects
framework.etc.dir=$RDECK_BASE/etc
framework.var.dir=$RDECK_BASE/var
framework.tmp.dir=$RDECK_BASE/var/tmp
framework.logs.dir=$RDECK_BASE/var/logs
framework.libext.dir=$RDECK_BASE/libext

# ----------------------------------------------------------------
# SSH defaults for node executor and file copier
# ----------------------------------------------------------------

framework.ssh.keypath = $RDECK_BASE/.ssh/id_rsa
framework.ssh.user = $USERNAME

# ssh connection timeout after a specified number of milliseconds.
# "0" value means wait forever.
framework.ssh.timeout = 0
rundeck.tokens.file=$HOME/etc/tokens.properties

# force UTF-8
#framework.remote.charset.default=UTF-8

rundeck.enable.ref.stats=true
END

cat > $HOME/etc/profile <<END
RDECK_BASE=$RDECK_BASE
export RDECK_BASE

JAVA_HOME=${JAVA_HOME:-/usr/lib/jvm/java-8-openjdk-amd64}
export JAVA_HOME

PATH=\$JAVA_HOME/bin:\$RDECK_BASE/tools/bin:\$PATH
export PATH


export LIBDIR=\$RDECK_BASE/tools/lib

CLI_CP=
for i in \`ls \$LIBDIR/*.jar\`
do
 CLI_CP=\${CLI_CP}:\${i}
done
export CLI_CP

# force UTF-8 default encoding
export RDECK_JVM="-Dfile.encoding=UTF-8 -Drundeck.bootstrap.build.info=true $RDECK_JVM_OPTS"<commit_msg>cleanup: no longer relevant<commit_after>#!/bin/bash

#exit on error
set -e

#Fix folder permissions
sudo chown -R $USERNAME:$USERNAME $HOME;

test ! -f $HOME/resources/$RUNDECK_NODE.ready || rm $HOME/resources/$RUNDECK_NODE.ready

#TODO SACAR
echo "######### start_rundeck on $RUNDECK_NODE ######### "
if test -f $HOME/resources/$RUNDECK_NODE.ready ; then
  echo "Already started, skipping..."
  exit 0
fi

# Some Cleanup
rm -rfv $HOME/server/logs/*
rm -fv $HOME/testdata/*

# Configure general stuff.
# configure hostname, nodename, url


# RUN TEST PRESTART SCRIPT
if [[ ! -z "$CONFIG_SCRIPT_PRESTART" && -f $CONFIG_SCRIPT_PRESTART ]];
then
  . $CONFIG_SCRIPT_PRESTART
else
  echo "### Prestart config not set. skipping..."
fi

export RDECK_BASE=$HOME
LOGFILE=$RDECK_BASE/var/log/service.log
mkdir -p $(dirname $LOGFILE)
FWKPROPS=$HOME/etc/framework.properties
mkdir -p $(dirname $FWKPROPS)

export RUNDECK_PORT=${RUNDECK_PORT:-4440}
export RUNDECK_URL=${RUNDECK_URL:-http://$RUNDECK_NODE:$RUNDECK_PORT}


# if [ -n "$SETUP_SSL" ] ; then
#   export RUNDECK_PORT=4443
#   export RUNDECK_URL=https://$RUNDECK_NODE:$RUNDECK_PORT
# fi

cat > $FWKPROPS <<END
framework.server.name = $RUNDECK_NODE
framework.server.hostname = $RUNDECK_NODE
framework.server.port = $RUNDECK_PORT
framework.server.url = $RUNDECK_URL

# ----------------------------------------------------------------
# Installation locations
# ----------------------------------------------------------------

rdeck.base=$RDECK_BASE

framework.projects.dir=$RDECK_BASE/projects
framework.etc.dir=$RDECK_BASE/etc
framework.var.dir=$RDECK_BASE/var
framework.tmp.dir=$RDECK_BASE/var/tmp
framework.logs.dir=$RDECK_BASE/var/logs
framework.libext.dir=$RDECK_BASE/libext

# ----------------------------------------------------------------
# SSH defaults for node executor and file copier
# ----------------------------------------------------------------

framework.ssh.keypath = $RDECK_BASE/.ssh/id_rsa
framework.ssh.user = $USERNAME

# ssh connection timeout after a specified number of milliseconds.
# "0" value means wait forever.
framework.ssh.timeout = 0
rundeck.tokens.file=$HOME/etc/tokens.properties

# force UTF-8
#framework.remote.charset.default=UTF-8

rundeck.enable.ref.stats=true
END

cat > $HOME/etc/profile <<END
RDECK_BASE=$RDECK_BASE
export RDECK_BASE

JAVA_HOME=${JAVA_HOME:-/usr/lib/jvm/java-8-openjdk-amd64}
export JAVA_HOME

PATH=\$JAVA_HOME/bin:\$RDECK_BASE/tools/bin:\$PATH
export PATH

# force UTF-8 default encoding
export RDECK_JVM="-Dfile.encoding=UTF-8 -Drundeck.bootstrap.build.info=true $RDECK_JVM_OPTS"
{'fraction_non_alphanumeric': 0.22108843537414966, 'fraction_numerical': 0.006802721088435374, 'mean_word_length': 3.0746728252501923, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 7, 'https://': 2, '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': '3744691', 'n_tokens_mistral': 1914, 'n_tokens_neox': 1810, 'n_words': 355}