<commit_before>#!/bin/bash
#
# PrivateOn-VPN -- Because privacy matters.
#
# Author: <NAME> <<EMAIL>>
#         <NAME> <<EMAIL>>
#
# Copyright (C) 2014  PrivateOn / Tietosuojakone Oy, Helsinki, Finland
# All rights reserved. Use is subject to license terms.
#

#
#  vpn-gui/kill_gui.sh     This script kills an existing instance of the vpn gui
#
#   Note: This script must be run with root credentials, preferably using sudo.
#


DAEMON=/opt/PrivateOn-VPN/vpn-gui/vpn_gui.pl

# Only root should use this script
if test "$(id -u)" -ne 0; then
	echo "${0##*/}: only root can use ${0##*/}" 1>&2
	exit 1
fi

# Run kill on list because "sudo vpn_gui.sh" produces 2 processes
for PID in $(pgrep -f $DAEMON); do
	# First ask system politely to close previous instances
	kill -TERM $PID >/dev/null 2>&1
done
for PID in $(pgrep -f $DAEMON); do
	# If that didn't help, be assertive
	kill -9 $PID >/dev/null 2>&1
done<commit_msg>Streamlined vpn-gui/kill_gui.sh script. Graceful termination would have required a call to sleep before kill -9. This would have needlessly slowed down the GUI restart process.<commit_after>#!/bin/bash
#
# PrivateOn-VPN -- Because privacy matters.
#
# Author: <NAME> <<EMAIL>>
#         <NAME> <<EMAIL>>
#
# Copyright (C) 2014  PrivateOn / Tietosuojakone Oy, Helsinki, Finland
# All rights reserved. Use is subject to license terms.
#

#
#  vpn-gui/kill_gui.sh     This script kills an existing instance of the vpn gui
#
#   Note: This script must be run with root credentials, preferably using sudo.
#


DAEMON=/opt/PrivateOn-VPN/vpn-gui/vpn_gui.pl

# Only root should use this script
if test "$(id -u)" -ne 0; then
	echo "${0##*/}: only root can use ${0##*/}" 1>&2
	exit 1
fi

# Run kill on list because "sudo vpn_gui.sh" produces multiple processes
for PID in $(pgrep -f $DAEMON); do
	kill -9 $PID >/dev/null 2>&1
done
{'fraction_non_alphanumeric': 0.12615551930396954, 'fraction_numerical': 0.01631321370309951, 'mean_word_length': 3.5544554455445545, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 23, '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': '5069248', 'n_tokens_mistral': 680, 'n_tokens_neox': 632, 'n_words': 246}