<commit_before>#!/bin/bash

### BEGIN INIT INFO
# Provides:           <%= @name %>
# Required-Start:     $local_fs $syslog
# Required-Stop:      $local_fs $syslog
# Default-Start:      2 3 4 5
# Default-Stop:       0 1 6
# Short-Description:  <%= @name %>
### END INIT INFO

NAME=<%= @name %>
DESC=<%= @name %>
DAEMON='<%= @binary %>'
DAEMON_ARGS='<%= @args %>'
PIDFILE='/var/run/<%= @name %>.pid'
USER='<%= @user %>'
<% unless @env.empty? %>
export<% @env.each do |name, value| -%> <%= name %>='<%= value %>'<% end -%>
<% end %>
<% @final_signal = @sysvinit_kill ? 'KILL' : 'TERM' -%>

set -e
. /lib/lsb/init-functions

case "${1}" in
	start)
		log_daemon_msg "Starting ${DESC}" "${NAME}"
		<% if @core_dump %>
		ulimit -c unlimited
		<%- end %>
		<% if @limit_nofile %>
		ulimit -n <%= @limit_nofile == 'unlimited' ? 'unlimited' : @limit_nofile %>
		<%- end %>
		<% if @limit_fsize %>
		ulimit -f <%= @limit_fsize == 'unlimited' ? 'unlimited' : @limit_fsize %>
		<%- end %>
		<% if @limit_cpu %>
		ulimit -t  <%= @limit_cpu == 'unlimited' ? 'unlimited' : @limit_cpu %>
		<%- end %>
		<% if @limit_as %>
		ulimit -v  <%= @limit_as == 'unlimited' ? 'unlimited' : @limit_as %>
		<%- end %>
		<% if @limit_rss %>
		ulimit -m  <%= @limit_rss == 'unlimited' ? 'unlimited' : @limit_rss %>
		<%- end %>
		<% if @limit_nproc %>
		ulimit -u  <%= @limit_nproc == 'unlimited' ? 'unlimited' : @limit_nproc %>
		<%- end %>
		<% if @pre_command %>
		<%= @pre_command %>
		<%- end %>
		<% if @runtime_directory %>
		mkdir -p /run/<%= @runtime_directory %>
      <% if @runtime_directory_mode %>
    chmod <%= @runtime_directory_mode %> /run/<%= @runtime_directory %>
      <%- end %>
		<%- end %>
		if (start-stop-daemon --start --oknodo --make-pidfile --background --pidfile "${PIDFILE}" --chuid "${USER}" --startas "${DAEMON}" -- ${DAEMON_ARGS}); then
		  timeout --signal=9 1 bash -c "while ! (test -e '${PIDFILE}'); do sleep 0.05; done";
		  PID=$(cat "${PIDFILE}")
			<% if @nice %>
				renice -n <%= @nice %> -p ${PID}
			<%- end %>
			<% if @oom_score_adjust %>
				echo <%= @oom_score_adjust %> > /proc/${PID}/oom_score_adj
			<%- end %>
			log_end_msg 0
			<% if @post_command %>
			<%= @post_command %>
			<%- end %>
		else
			log_end_msg 1
		fi
	;;
	stop)
		log_daemon_msg "Stopping ${DESC}" "${NAME}"
		if (start-stop-daemon --stop --oknodo --retry TERM/<%= @stop_timeout %>/<%= @final_signal %>/<%= @stop_timeout %> --pidfile "${PIDFILE}" --user "${USER}"); then
			rm -f "${PIDFILE}"
			log_end_msg 0
		else
			log_end_msg 1
		fi
	;;<commit_msg>Adjust format<commit_after>#!/bin/bash

### BEGIN INIT INFO
# Provides:           <%= @name %>
# Required-Start:     $local_fs $syslog
# Required-Stop:      $local_fs $syslog
# Default-Start:      2 3 4 5
# Default-Stop:       0 1 6
# Short-Description:  <%= @name %>
### END INIT INFO

NAME=<%= @name %>
DESC=<%= @name %>
DAEMON='<%= @binary %>'
DAEMON_ARGS='<%= @args %>'
PIDFILE='/var/run/<%= @name %>.pid'
USER='<%= @user %>'
<% unless @env.empty? %>
export<% @env.each do |name, value| -%> <%= name %>='<%= value %>'<% end -%>
<% end %>
<% @final_signal = @sysvinit_kill ? 'KILL' : 'TERM' -%>

set -e
. /lib/lsb/init-functions

case "${1}" in
	start)
		log_daemon_msg "Starting ${DESC}" "${NAME}"
		<% if @core_dump %>
		ulimit -c unlimited
		<%- end %>
		<% if @limit_nofile %>
		ulimit -n <%= @limit_nofile == 'unlimited' ? 'unlimited' : @limit_nofile %>
		<%- end %>
		<% if @limit_fsize %>
		ulimit -f <%= @limit_fsize == 'unlimited' ? 'unlimited' : @limit_fsize %>
		<%- end %>
		<% if @limit_cpu %>
		ulimit -t  <%= @limit_cpu == 'unlimited' ? 'unlimited' : @limit_cpu %>
		<%- end %>
		<% if @limit_as %>
		ulimit -v  <%= @limit_as == 'unlimited' ? 'unlimited' : @limit_as %>
		<%- end %>
		<% if @limit_rss %>
		ulimit -m  <%= @limit_rss == 'unlimited' ? 'unlimited' : @limit_rss %>
		<%- end %>
		<% if @limit_nproc %>
		ulimit -u  <%= @limit_nproc == 'unlimited' ? 'unlimited' : @limit_nproc %>
		<%- end %>
		<% if @pre_command %>
		<%= @pre_command %>
		<%- end %>
		<% if @runtime_directory %>
		mkdir -p /run/<%= @runtime_directory %>
		<% if @runtime_directory_mode %>
		chmod <%= @runtime_directory_mode %> /run/<%= @runtime_directory %>
		<%- end %>
		<%- end %>
		if (start-stop-daemon --start --oknodo --make-pidfile --background --pidfile "${PIDFILE}" --chuid "${USER}" --startas "${DAEMON}" -- ${DAEMON_ARGS}); then
		  timeout --signal=9 1 bash -c "while ! (test -e '${PIDFILE}'); do sleep 0.05; done";
		  PID=$(cat "${PIDFILE}")
			<% if @nice %>
				renice -n <%= @nice %> -p ${PID}
			<%- end %>
			<% if @oom_score_adjust %>
				echo <%= @oom_score_adjust %> > /proc/${PID}/oom_score_adj
			<%- end %>
			log_end_msg 0
			<% if @post_command %>
			<%= @post_command %>
			<%- end %>
		else
			log_end_msg 1
		fi
	;;
	stop)
		log_daemon_msg "Stopping ${DESC}" "${NAME}"
		if (start-stop-daemon --stop --oknodo --retry TERM/<%= @stop_timeout %>/<%= @final_signal %>/<%= @stop_timeout %> --pidfile "${PIDFILE}" --user "${USER}"); then
			rm -f "${PIDFILE}"
			log_end_msg 0
		else
			log_end_msg 1
		fi
	;;
{'fraction_non_alphanumeric': 0.2346456692913386, 'fraction_numerical': 0.0066929133858267716, 'mean_word_length': 3.058306709265176, 'pattern_counts': {'":': 0, '<': 117, '<?xml version=': 0, '>': 119, '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': '3940623', 'n_tokens_mistral': 2395, 'n_tokens_neox': 1983, 'n_words': 449}