<commit_before>#!/bin/sh
#
# Startup script for livy
#
### BEGIN INIT INFO
# Provides:                     livy*
# Required-Start:                 
# Should-Start:                 
# Required-Stop:                  
# Default-Start:                2 3 4 5
# Default-Stop:                 0 1 6
# Short-Description:            start and stop livy-*
# Description:                  Start/Stop/Restart livy
### END INIT INFO

# Variables

START_PROG="<%= node.hadoop_spark.home %>/sbin/start-livy.sh"  
STOP_PROG="<%= node.hadoop_spark.home %>/sbin/stop-livy.sh"  

RETVAL=0

ulimit -n 65000

EXEC_WITH_USER="su -c <%= node.hadoop_spark.user %>"

start() {
  $EXEC_WITH_USER "$START_PROG"
  return $?
}

stop() {
  $EXEC_WITH_USER "$STOP_PROG"
  return $?
}

restart() {
  $EXEC_WITH_USER "$STOP_PROG"
  $EXEC_WITH_USER "$START_PROG"
  return $?
}

status() {
  PID_FILE=/tmp/livy.pid
  if [ -f $PID_FILE ] ; then
     PID=`cat $PID_FILE`
     kill -0 $PID
     res=$?
  else 
     res=1
  fi
  if [ $res -eq 0 ] ; then
   echo "livy($PID) is running"
  else
   echo "livy is not running"
  fi
  return $res
}


# user-supplied parameter to stop/start/restart process.
case "$1" in
  start)
    start
    ;;
  stop)
    stop
    ;;
  restart)
    restart
    ;;
  reload)
    restart
    ;;
  status)
    status
    ;;
  -h|--help)
    echo ""
    echo "usage: <prog> start|stop|restart|status"
    echo ""
    exit 0
    ;;
  *)
    echo $"Usage: <prog> {start|stop|restart|status}"
    exit 1
  esac


exit $RETVAL
<commit_msg>init.d script fix for ubuntu/livy-server<commit_after>#!/bin/sh
#
# Startup script for livy
#
### BEGIN INIT INFO
# Provides:                     livy*
# Required-Start:                 
# Should-Start:                 
# Required-Stop:                  
# Default-Start:                2 3 4 5
# Default-Stop:                 0 1 6
# Short-Description:            start and stop livy-*
# Description:                  Start/Stop/Restart livy
### END INIT INFO

# Variables

START_PROG="<%= node.hadoop_spark.home %>/sbin/start-livy.sh"  
STOP_PROG="<%= node.hadoop_spark.home %>/sbin/stop-livy.sh"  

RETVAL=0

ulimit -n 65000

EXEC_WITH_USER="su <%= node.hadoop_spark.user %> -c"

start() {
  $EXEC_WITH_USER "$START_PROG"
  return $?
}

stop() {
  $EXEC_WITH_USER "$STOP_PROG"
  return $?
}

restart() {
  $EXEC_WITH_USER "$STOP_PROG"
  $EXEC_WITH_USER "$START_PROG"
  return $?
}

status() {
  PID_FILE=/tmp/livy.pid
  if [ -f $PID_FILE ] ; then
     PID=`cat $PID_FILE`
     kill -0 $PID
     res=$?
  else 
     res=1
  fi
  if [ $res -eq 0 ] ; then
   echo "livy($PID) is running"
  else
   echo "livy is not running"
  fi
  return $res
}


# user-supplied parameter to stop/start/restart process.
case "$1" in
  start)
    start
    ;;
  stop)
    stop
    ;;
  restart)
    restart
    ;;
  reload)
    restart
    ;;
  status)
    status
    ;;
  -h|--help)
    echo ""
    echo "usage: <prog> start|stop|restart|status"
    echo ""
    exit 0
    ;;
  *)
    echo $"Usage: <prog> {start|stop|restart|status}"
    exit 1
  esac


exit $RETVAL

{'fraction_non_alphanumeric': 0.13803182851575188, 'fraction_numerical': 0.012341669373173108, 'mean_word_length': 2.0434782608695654, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 13, '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': '6408001', 'n_tokens_mistral': 1243, 'n_tokens_neox': 1149, 'n_words': 264}