<commit_before><commit_msg>Moving the feedback script to a place where it actually makes sense.<commit_after>#!/usr/bin/env bash

OUTPUT=/tmp/`date +%Y-%m-%d_%H:%m:%S`-platform-feedback
echo -n "Writing system status to \"${OUTPUT}\"... "
mkdir -p ${OUTPUT}

df -h > ${OUTPUT}/disk-free-space.txt
df -i > ${OUTPUT}/disk-free-inodes.txt
sudo dmesg > ${OUTPUT}/dmesg.txt

if [[ -f /data/dokku/.ssh/authorized_keys ]]; then
ssh-keygen -l -f /data/dokku/.ssh/authorized_keys > ${OUTPUT}/dokku-ssh-keys.log
fi

if [[ -x $(which systemctl) ]]; then
    sudo systemctl > ${OUTPUT}/systemd-service-list.txt
    sudo systemctl | awk '/fail/ {print $1}' | xargs -n 1 -i sudo systemctl status {} > ${OUTPUT}/systemd-service-status-failed.txt
fi

if [[ -x $(which journalctl) ]]; then
    sudo journalctl -b > ${OUTPUT}/current.log
    sudo journalctl -b "-1" > ${OUTPUT}/previous.log
fi

if [[ -x $(which docker) ]]; then
    docker ps -a > ${OUTPUT}/docker-ps-a.txt
    docker images > ${OUTPUT}/docker-images.txt
fi

if [[ -x $(which zfs) ]]; then
    sudo zpool list > ${OUTPUT}/zpool-list.txt
    sudo zpool status  > ${OUTPUT}/zpool-status.txt
    sudo zpool get all  > ${OUTPUT}/zpool-get-all.txt
    sudo zpool history  > ${OUTPUT}/zpool-history.txt
    sudo zpool events  > ${OUTPUT}/zpool-events.txt
    sudo zfs list  > ${OUTPUT}/zfs-list.txt
    sudo zfs get all  > ${OUTPUT}/zfs-get-all.txt
fi

tar cfz ${OUTPUT}.tgz ${OUTPUT} && rm -rf ${OUTPUT}
echo -e "\n\n\nPLEASE SEND '${OUTPUT}.tgz' TO YOUR FRIENDLY SUPPORT TEAM. THANK YOU\n"

# TODO: send it and then clean up
{'fraction_non_alphanumeric': 0.17654557042702357, 'fraction_numerical': 0.0019120458891013384, 'mean_word_length': 3.266304347826087, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 20, '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': '2734276', 'n_tokens_mistral': 595, 'n_tokens_neox': 561, 'n_words': 157}