<commit_before>#!/bin/bash
. /opt/farm/scripts/functions.custom
. /opt/farm/scripts/functions.keys
# This script is intended to be used only on farm manager, when:
# - backup collector role is delegated to another server
# - backup collector doesn't have ssh key to farm manager
# - farm manager has ssh root key for backup collector
#
# Such scheme can occur eg. in increased-security-farms (along with backup
# encryption), where farm manager is operated only by carefully selected
# staff, while backup collector has wider access.

TMP="`local_backup_directory`"


type=`/opt/farm/scripts/config/detect-hostname-type.sh $1`

if [ "$1" = "" ]; then
	echo "usage: $0 <collector-hostname[:port]> [--all]"
	exit 1
elif [ "$type" != "hostname" ] && [ "$type" != "ip" ]; then
	echo "error: parameter $1 not conforming hostname format, or given hostname is invalid"
	exit 1
fi

if [ "$2" != "--all" ]; then
	files="`add_backup_extension $TMP/daily/'*'`"
else
	files="`add_backup_extension $TMP/daily/'*'` `add_backup_extension $TMP/weekly/'*'` `add_backup_extension $TMP/custom/'*'`"
fi

server=$1
if [ -z "${server##*:*}" ]; then
	host="${server%:*}"
	port="${server##*:}"
else
	host=$server
	port=22
fi

sshkey=`ssh_management_key_storage_filename $host`<commit_msg>reimplemented hostname checks as bash function, without separate script<commit_after>#!/bin/bash
. /opt/farm/scripts/functions.net
. /opt/farm/scripts/functions.custom
. /opt/farm/scripts/functions.keys
# This script is intended to be used only on farm manager, when:
# - backup collector role is delegated to another server
# - backup collector doesn't have ssh key to farm manager
# - farm manager has ssh root key for backup collector
#
# Such scheme can occur eg. in increased-security-farms (along with backup
# encryption), where farm manager is operated only by carefully selected
# staff, while backup collector has wider access.

TMP="`local_backup_directory`"


if [ "$1" = "" ]; then
	echo "usage: $0 <collector-hostname[:port]> [--all]"
	exit 1
elif [ "`resolve_host $1`" = "" ]; then
	echo "error: parameter $1 not conforming hostname format, or given hostname is invalid"
	exit 1
fi

if [ "$2" != "--all" ]; then
	files="`add_backup_extension $TMP/daily/'*'`"
else
	files="`add_backup_extension $TMP/daily/'*'` `add_backup_extension $TMP/weekly/'*'` `add_backup_extension $TMP/custom/'*'`"
fi

server=$1
if [ -z "${server##*:*}" ]; then
	host="${server%:*}"
	port="${server##*:}"
else
	host=$server
	port=22
fi

sshkey=`ssh_management_key_storage_filename $host`
{'fraction_non_alphanumeric': 0.15078740157480314, 'fraction_numerical': 0.007874015748031496, 'mean_word_length': 4.814645308924485, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '4006222', 'n_tokens_mistral': 858, 'n_tokens_neox': 824, 'n_words': 264}