<commit_before>package eu.choreos.gmond.reloader;

public class GmondReloader {

	private String commandRestartMonitor;

	private Runtime runtime;
	@SuppressWarnings("unused") //Used for testing purposes
	private Process proc;

	public GmondReloader() {
		commandRestartMonitor = "/etc/init.d/ganglia-monitor restart";
		runtime = null;
	}

	public void setRuntime(Runtime runtime) {
		this.runtime = runtime;
	}

	public boolean reload() {
		Process procReturned = runCommand(commandRestartMonitor);
		try {
			procReturned.waitFor();
		} catch (InterruptedException e) {
			e.printStackTrace();
		}
		if (procReturned.exitValue() == 0)
			return true;
		return false;
	}<commit_msg>Added SIGHUP support to GmongReload. When process is not running, it is started<commit_after>package eu.choreos.gmond.reloader;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class GmondReloader {

	private String commandRestartMonitor;

	private Runtime runtime;
	@SuppressWarnings("unused") //Used for testing purposes
	private Process proc;

	private String commandReloadMonitor;

	public GmondReloader() {
		commandRestartMonitor = "/etc/init.d/ganglia-monitor restart";
		commandReloadMonitor = "kill -1 $( cat /var/run/gmond.pid )";
		runtime = null;
	}

	public void setRuntime(Runtime runtime) {
		this.runtime = runtime;
	}

	public boolean reload() {
		Process procReturned;
		if(gmondIsRunning())
			procReturned = runCommand(commandReloadMonitor);
		else
			procReturned = runCommand(commandRestartMonitor);
		try {
			procReturned.waitFor();
		} catch (InterruptedException e) {
			e.printStackTrace();
		}
		if (procReturned.exitValue() == 0)
			return true;
		return false;
	}

	private boolean gmondIsRunning() {
		
		Process proc = runCommand("ps -ef | grep gmond");
		
		try {
			proc.waitFor();
		} catch (InterruptedException e1) {
			e1.printStackTrace();
		}
		
		BufferedReader in = new BufferedReader(new InputStreamReader(proc.getInputStream()));
		String line;
		
		try {
			while ((line = in.readLine()) != null) {
				if(line.contains("/usr/sbin/gmond")) return true;
			}
		} catch (IOException e) {
			e.printStackTrace();
		}
				
		return false;
	}
{'fraction_non_alphanumeric': 0.11041009463722397, 'fraction_numerical': 0.002253267237494367, 'mean_word_length': 4.150812064965197, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '418724', 'n_tokens_mistral': 776, 'n_tokens_neox': 690, 'n_words': 169}