<commit_before>##License: (MIT), Copyright (C) 2013 Author <NAME>.

ps_list = `ps h -eo cmd`

require 'socket'
host = Socket.gethostname


dir = File.dirname(__FILE__)

	load File.expand_path("#{dir}/conf/general_restart_contact")

Dir[File.expand_path("#{dir}/conf/restart_*")]. uniq. each do |file|

	load file

	list = ps_list.split(/\n/)

restart_msgstr = <<END_OF_MESSAGE
From: #$restart_from <#$restart_from_email>
To: #$restart_to <#$restart_to_email>
Subject: Dead Process Detected On #{host}

Process Watch has detected #{$restart_process} has died.

We have started #{$restart_process} again.

-Process Watch

END_OF_MESSAGE

dead_process_msgstr = <<END_OF_MESSAGE
From: #$restart_from <#$restart_from_email>
To: #$restart_to <#$restart_to_email>
Subject: Dead Process Detected On #{host}

Process Watch has detected #{$restart_process} has died.

-Process Watch

END_OF_MESSAGE


	occurances = list.grep(/.*#$restart_process.*/)
	if occurances.length == 0 && $restart_mail == "yes" && $restart_start == "yes"

		system $restart_action
		
	 	require 'net/smtp'
		Net::SMTP.start("#$restart_smtp_host", "#$restart_smtp_port") do |smtp|
		smtp.send_message(restart_msgstr, "#$restart_from_email", "#$restart_to_email")
	end

	elsif occurances.length == 0 && $restart_mail == "yes" && $restart_start == "no"

		require 'net/smtp'
		Net::SMTP.start("#$restart_smtp_host", "#$restart_smtp_port") do |smtp|
		smtp.send_message(dead_process_msgstr, "#$restart_from_email", "#$restart_to_email")
	end

	elsif occurances.length == 0 && $restart_mail == "no" && $restart_start == "yes"

		system $restart_action


	else 
	
	exit
<commit_msg>Fixed a problem with an unecessary exiting of a loop<commit_after>##License: (MIT), Copyright (C) 2013 Author <NAME>.

ps_list = `ps h -eo cmd`

require 'socket'
host = Socket.gethostname


dir = File.dirname(__FILE__)

	load File.expand_path("#{dir}/conf/general_restart_contact")

Dir[File.expand_path("#{dir}/conf/restart_*")]. uniq. each do |file|

	load file

	list = ps_list.split(/\n/)

restart_msgstr = <<END_OF_MESSAGE
From: #$restart_from <#$restart_from_email>
To: #$restart_to <#$restart_to_email>
Subject: Dead Process Detected On #{host}

Process Watch has detected #{$restart_process} has died.

We have started #{$restart_process} again.

-Process Watch

END_OF_MESSAGE

dead_process_msgstr = <<END_OF_MESSAGE
From: #$restart_from <#$restart_from_email>
To: #$restart_to <#$restart_to_email>
Subject: Dead Process Detected On #{host}

Process Watch has detected #{$restart_process} has died.

-Process Watch

END_OF_MESSAGE


	occurances = list.grep(/.*#$restart_process.*/)
	if occurances.length == 0 && $restart_mail == "yes" && $restart_start == "yes"

		system $restart_action
		
	 	require 'net/smtp'
		Net::SMTP.start("#$restart_smtp_host", "#$restart_smtp_port") do |smtp|
		smtp.send_message(restart_msgstr, "#$restart_from_email", "#$restart_to_email")
	end

	elsif occurances.length == 0 && $restart_mail == "yes" && $restart_start == "no"

		require 'net/smtp'
		Net::SMTP.start("#$restart_smtp_host", "#$restart_smtp_port") do |smtp|
		smtp.send_message(dead_process_msgstr, "#$restart_from_email", "#$restart_to_email")
	end

	elsif occurances.length == 0 && $restart_mail == "no" && $restart_start == "yes"

		system $restart_action

{'fraction_non_alphanumeric': 0.15012106537530268, 'fraction_numerical': 0.00423728813559322, 'mean_word_length': 5.649899396378269, 'pattern_counts': {'":': 0, '<': 21, '<?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': '1498877', 'n_tokens_mistral': 1320, 'n_tokens_neox': 1228, 'n_words': 269}