<commit_before>#!/bin/sh

# install_agent.sh
# create xbaydns user and generate the ssh key.
# Created by Razor <<EMAIL>> on 2008-03-24.
# Copyright (c) 2008 xBayDNS Team. All rights reserved.

USER="xbaydns"
GROUP="xbaydns"
UID=60190
GID=60190
OSTYPE="`uname`"
KEYBITS=2048
INSTALLPATH="/data0/xbaydns"
MASTER_PUB="ssh-rsa <KEY>== root@razor"

if [ "`id -u`" != "0" ]; then
	echo "Run this script using root user."
	exit 1
fi

# create user and group
case ${OSTYPE} in
	FreeBSD) 
		pw groupadd ${GROUP} -g${GID}
		pw useradd ${USER} -u${UID} -s/sbin/nologin -d${INSTALLPATH}
	;;
	*) echo "Not implement";;
esac

# generate ssh key
mkdir -p ${INSTALLPATH}/.ssh
ssh-keygen -t rsa -b ${KEYBITS} -f ${INSTALLPATH}/.ssh/id_rsa -N ''

# add the master's public key to authorized
echo ${MASTER_PUB} > ${INSTALLPATH}/.ssh/authorized_keys

# rsync agent
# rsync -az -e 'ssh -i ${INSTALLPATH}/.ssh/id_rsa' ${USER}@${MASTERIP}:${INSTALLPATH}/agent/\* ${INSTALLPATH}

# add to cron
grep -v iplatency /etc/crontab > /tmp/crontab.xbaydns
echo "*	*/1	*	*	*	${USER}	${INSTALLPATH}/iplatency/iplatency_agent.sh" >> /tmp/crontab.xbaydns
mv /tmp/crontab.xbaydns /etc/crontab
<commit_msg>Add script for installing the agent.<commit_after>#!/bin/sh

# install_agent.sh
# create xbaydns user and generate the ssh key.
# Created by Razor <bg1tpt AT <EMAIL>> on 2008-03-24.
# Copyright (c) 2008 xBayDNS Team. All rights reserved.

USER="xbaydns"
GROUP="xbaydns"
UID=60190
GID=60190
OSTYPE="`uname`"
KEYBITS=2048
INSTALLPATH="/data0/xbaydns"
MASTER_PUB="<KEY>ZD4H6EUnu/KwGpvpb6p/pvOrcohw8Wk6m8gT6H8n6gt0XRsRPo0PUry9CzOxjiJl0/sz86aSU+NlSCnxmqigx6FfO2s4KpbVfV8kzsvlwW7X8aVUtU7NE3/d7VE+M8ZV2v/KR4+MUHJr9aYBhxbbe8aT1w== root@razor"
MASTERIP="10.210.132.71"

if [ "`id -u`" != "0" ]; then
	echo "Run this script using root user."
	exit 1
fi

# create user and group
case ${OSTYPE} in
	FreeBSD) 
		pw groupadd ${GROUP} -g${GID}
		pw useradd ${USER} -u${UID} -s/sbin/nologin -d${INSTALLPATH}
	;;
	*) echo "Not implement";;
esac

# generate ssh key
mkdir -p ${INSTALLPATH}/.ssh
ssh-keygen -t rsa -b ${KEYBITS} -f ${INSTALLPATH}/.ssh/id_rsa -N ''

# add the master's public key to authorized
echo ${MASTER_PUB} > ${INSTALLPATH}/.ssh/authorized_keys

# rsync agent
# rsync -az -e 'ssh -i ${INSTALLPATH}/.ssh/id_rsa' ${USER}@${MASTERIP}:${INSTALLPATH}/agent/\* ${INSTALLPATH}

# add to cron
grep -v iplatency /etc/crontab > /tmp/crontab.xbaydns
echo "*	*/1	*	*	*	${USER}	${INSTALLPATH}/iplatency/iplatency_agent.sh" >> /tmp/crontab.xbaydns
mv /tmp/crontab.xbaydns /etc/crontab

{'fraction_non_alphanumeric': 0.16443745082612116, 'fraction_numerical': 0.03973249409913454, 'mean_word_length': 4.504329004329004, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 17, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 1, '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': '643644', 'n_tokens_mistral': 1211, 'n_tokens_neox': 1103, 'n_words': 249}