<commit_before><commit_msg>Create mon.sh<commit_after>#!/bin/bash
read -p "Is this the first node? [y,N] " first
case $first in
  y|Y)
    sudo apt-get -y install net-tools ipcalc ceph-deploy
    if [ ! -d ~/ceph ]
    then
      mkdir ~/ceph
    fi
    cd ~/ceph
    sudo ceph-deploy $HOSTNAME
    ifconfig | awk -v RS="\n\n" '{ for (i=1; i<=NF; i++) if ($i == "inet" && $(i+1) ~ /^addr:/) address = substr($(i+1), 6); if (address != "127.0.0.1") printf "%s\t%s\n", $1, address }'
    read -p "Which adapter should be used for the ceph cluster? " nic
    addr=$(ifconfig $nic | grep Mask | awk '{print $2}' | awk '{split($0,a,":"); print a[2]}'
    mask=$(ifconfig $nic | grep Mask | awk '{print $4}' | awk '{split($0,a,":"); print a[2]}'
    net=$(ipcalc -n $addr $mask | grep Network | awk '{print $2}')
    echo "osd pool default size = 2" >> ceph.conf
    echo "public network = $net" >> ceph.conf
    ceph-deploy install $HOSTNAME
    ceph-deploy mon create-initial
    ceph-deploy admin $HOSTNAME
    chmod +r /etc/ceph
    chmod +r /etc/ceph/*
    chmod +r /var/lib/ceph
    chmod +r /var/lib/ceph/*
    chmod +r /var/lib/ceph/*/*
    ;;
  n|N)
    ifconfig | awk -v RS="\n\n" '{ for (i=1; i<=NF; i++) if ($i == "inet" && $(i+1) ~ /^addr:/) address = substr($(i+1), 6); if (address != "127.0.0.1") printf "%s\t%s\n", $1, address }'
    read -p "Which adapter should be used for the ceph cluster? " nic
    chaddr=$(ifconfig $nic | grep HWaddr | awk '{print $5}')
    mask=$(ifconfig $nic | grep Mask | awk '{print $4}' | awk '{split($0,a,":"); print a[2]}'
    net=$(ipcalc -n $addr $mask | grep Network | awk '{print $2}')
    read -p "What is the hostname or IP of an active node? " node
    ssh -t $node "ssh-keygen -R $HOSTNAME && ssh-copy-id $(whoami)@$HOSTNAME"
    ssh -t $node "cd ~/ceph && ceph-deploy mon create $HOSTNAME"
    ;;
esac
{'fraction_non_alphanumeric': 0.20356371490280778, 'fraction_numerical': 0.018898488120950324, 'mean_word_length': 2.8684759916492695, 'pattern_counts': {'":': 3, '<': 5, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 2, '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': '6571954', 'n_tokens_mistral': 749, 'n_tokens_neox': 712, 'n_words': 230}