42 changed files with 821 additions and 4568 deletions
@ -0,0 +1,3 @@ |
|||
boot-* |
|||
boot_* |
|||
|
@ -0,0 +1,53 @@ |
|||
#!/bin/bash |
|||
# Raspberry Pi stress CPU temperature measurement script. |
|||
# |
|||
# Download this script (e.g. with wget) and give it execute permissions (chmod +x). |
|||
# Then run it with ./pi-cpu-stress.sh |
|||
|
|||
# Variables. |
|||
test_run=1 |
|||
test_results_file="${HOME}/cpu_temp_$test_run.log" |
|||
stress_length="10m" |
|||
|
|||
# Verify stress-ng is installed. |
|||
if ! [ -x "$(command -v stress-ng)" ]; then |
|||
printf "Error: stress-ng not installed.\n" |
|||
printf "To install: sudo apt install -y stress-ng\n" >&2 |
|||
exit 1 |
|||
fi |
|||
|
|||
printf "Logging temperature and throttling data to: $test_results_file\n" |
|||
|
|||
# Start logging temperature data in the background. |
|||
while /bin/true; do |
|||
# Print the date (e.g. "Wed 13 Nov 18:24:45 GMT 2019") and a tab. |
|||
date | tr '\n' '\t' >> $test_results_file; |
|||
|
|||
# Print the temperature (e.g. "39.0") and a tab. |
|||
vcgencmd measure_temp | tr -d "temp=" | tr -d "'C" | tr '\n' '\t' >> $test_results_file; |
|||
|
|||
# Print the throttle status (e.g. "0x0") and a tab. |
|||
vcgencmd get_throttled | tr -d "throttled=" | tr '\n' '\t' >> $test_results_file; |
|||
|
|||
# Print the current CPU frequency. |
|||
vcgencmd measure_clock arm | sed 's/^.*=//' >> $test_results_file; |
|||
sleep 5; |
|||
done & |
|||
|
|||
# Store the logging pid. |
|||
PROC_ID=$! |
|||
|
|||
# Stop the logging loop if script is interrupted or when it ends. |
|||
trap "kill $PROC_ID" EXIT |
|||
|
|||
# After 5 minutes, run stress. |
|||
printf "Waiting 5 minutes for stable idle temperature...\n" |
|||
sleep 300 |
|||
printf "Beginning $stress_length stress test...\n" |
|||
stress-ng -c 4 --timeout $stress_length |
|||
|
|||
# Keep logging for 5 more minutes. |
|||
printf "Waiting 5 minutes to return to idle temperature...\n" |
|||
sleep 300 |
|||
|
|||
printf "Test complete.\n" |
@ -0,0 +1,12 @@ |
|||
#! /bin/bash |
|||
targetfolder=/backup/Backup-Repo/ |
|||
|
|||
if [ "$1" ]; then |
|||
echo "setting targetfolder to ${1}" |
|||
targetfolder=${1} |
|||
fi |
|||
|
|||
echo "targetfolder=${targetfolder}" |
|||
syncdirs -d -f /tank/Backup-Repo/ -t ${targetfolder} |
|||
#rsync -a -v -z --progress --delete --update --human-readable --stats --progress /tank/Backup-Repo/ ${targetfolder} |
|||
|
@ -0,0 +1,9 @@ |
|||
#!/bin/sh |
|||
targetfolder=/backup/borg/ |
|||
|
|||
if [ "$1" ]; then |
|||
echo "setting targetfolder to ${1}" |
|||
targetfolder=${1} |
|||
fi |
|||
syncdirs -d -f /tank/borg/ -t ${targetfolder} |
|||
#rsync -a -v -z --progress --update --delete --human-readable --stats --progress /tank/borg ${targetfolder} |
@ -1,12 +1,25 @@ |
|||
#! /bin/bash |
|||
|
|||
function fan_speed() { |
|||
if [ -f /sys/devices/platform/cooling_fan/hwmon/hwmon2/fan1_imput ]; then |
|||
echo -n "Fan-Speed am {$1}: " |
|||
cat /sys/devices/platform/cooling_fan/hwmon/hwmon2/fan1_input |
|||
fi |
|||
} |
|||
|
|||
cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq |
|||
vcgencmd measure_temp |
|||
fan_speed "Anfang" |
|||
|
|||
sysbench --test=cpu --cpu-max-prime=1000 --num-threads=4 run >/dev/null 2>&1 |
|||
vcgencmd measure_temp |
|||
sysbench cpu --cpu-max-prime=1000 --threads=4 run >/dev/null 2>&1 |
|||
|
|||
cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq |
|||
|
|||
sysbench --test=cpu --cpu-max-prime=50000 --num-threads=4 run |
|||
for f in {1..10} |
|||
do |
|||
vcgencmd measure_temp |
|||
sysbench cpu --cpu-max-prime=50000 --threads=4 run |
|||
done |
|||
cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq |
|||
vcgencmd measure_temp |
|||
fan_speed "Ende" |
|||
|
@ -0,0 +1,77 @@ |
|||
#!/usr/bin/env bash |
|||
set -euo pipefail |
|||
|
|||
# Dauer des Tests (Default: 10 Minuten, Format z.B. "5m", "600") |
|||
DURATION="${1:-10m}" |
|||
|
|||
# Verzeichnisse / Geräte für File‑IO |
|||
NVME_MOUNT="~/test" # bitte anpassen |
|||
SATA_MOUNT="/mnt/nextcloud/test" # bitte anpassen |
|||
|
|||
# Größe und Einstellungen für sysbench-File‑IO |
|||
FILE_TOTAL_SIZE="1G" |
|||
FILE_NUM="4" |
|||
TEST_MODE="rndrw" |
|||
EXTRA_FLAGS="--file-extra-flags=direct" |
|||
|
|||
echo "== Vorbereitung: File‑IO Testdateien erstellen ==" |
|||
sysbench fileio \ |
|||
--file-total-size=${FILE_TOTAL_SIZE} \ |
|||
--file-num=${FILE_NUM} \ |
|||
--file-test-mode=${TEST_MODE} \ |
|||
${EXTRA_FLAGS} \ |
|||
--file-dir=${NVME_MOUNT} prepare & |
|||
sysbench fileio \ |
|||
--file-total-size=${FILE_TOTAL_SIZE} \ |
|||
--file-num=${FILE_NUM} \ |
|||
--file-test-mode=${TEST_MODE} \ |
|||
${EXTRA_FLAGS} \ |
|||
--file-dir=${SATA_MOUNT} prepare & |
|||
wait |
|||
echo "== Vorbereitung fertig, starte Stresstest für ${DURATION} ==" |
|||
|
|||
# CPU‑Stresstest |
|||
stress-ng \ |
|||
--cpu 8 \ |
|||
--cpu-method all \ |
|||
--verify \ |
|||
--timeout ${DURATION} \ |
|||
--metrics-brief \ |
|||
> stress-ng.log 2>&1 & |
|||
|
|||
# File‑IO auf NVMe |
|||
sysbench fileio \ |
|||
--file-total-size=${FILE_TOTAL_SIZE} \ |
|||
--file-num=${FILE_NUM} \ |
|||
--file-test-mode=${TEST_MODE} \ |
|||
${EXTRA_FLAGS} \ |
|||
--file-dir=${NVME_MOUNT} \ |
|||
--time=${DURATION} run \ |
|||
> sysbench-nvme.log 2>&1 & |
|||
|
|||
# File‑IO auf SATA‑SSD |
|||
sysbench fileio \ |
|||
--file-total-size=${FILE_TOTAL_SIZE} \ |
|||
--file-num=${FILE_NUM} \ |
|||
--file-test-mode=${TEST_MODE} \ |
|||
${EXTRA_FLAGS} \ |
|||
--file-dir=${SATA_MOUNT} \ |
|||
--time=${DURATION} run \ |
|||
> sysbench-sata.log 2>&1 & |
|||
|
|||
# Auf alle Hintergrund‐Jobs warten |
|||
wait |
|||
|
|||
echo "== Stresstest abgeschlossen ==" |
|||
echo "Ergebnisse:" |
|||
echo " - CPU (stress-ng): see stress-ng.log" |
|||
echo " - NVMe (sysbench): see sysbench-nvme.log" |
|||
echo " - SATA (sysbench): see sysbench-sata.log" |
|||
|
|||
# Clean up File‑IO Testdateien |
|||
echo "== Aufräumen: File‑IO Testdateien löschen ==" |
|||
sysbench fileio ${EXTRA_FLAGS} --file-dir=${NVME_MOUNT} cleanup |
|||
sysbench fileio ${EXTRA_FLAGS} --file-dir=${SATA_MOUNT} cleanup |
|||
|
|||
echo "Fertig." |
|||
|
@ -0,0 +1,13 @@ |
|||
--- |
|||
- hosts: "{{ target }}" |
|||
tasks: |
|||
- debug: |
|||
var: ansible_kernel |
|||
- name: "Check kernel version" |
|||
command: uname -r |
|||
register: kernel_check |
|||
changed_when: false |
|||
|
|||
- debug: |
|||
var:kernel_check |
|||
|
@ -0,0 +1,14 @@ |
|||
--- |
|||
- hosts: "{{ target }}" |
|||
gather_facts: false |
|||
remote_user: pi |
|||
vars_files: |
|||
- vars/nextcloud-dirs.txt |
|||
roles: |
|||
- initpi |
|||
- installpkg |
|||
- mounttank |
|||
- installsoft |
|||
- disableswap |
|||
- initnextcloud |
|||
|
File diff suppressed because it is too large
@ -0,0 +1,4 @@ |
|||
/opt |
|||
/home |
|||
/etc |
|||
/mnt/nvme |
@ -0,0 +1,50 @@ |
|||
#!/bin/bash |
|||
######################################################################### |
|||
# Copyright (C) 2020 Akito <the@akito.ooo> # |
|||
# # |
|||
# This program is free software: you can redistribute it and/or modify # |
|||
# it under the terms of the GNU General Public License as published by # |
|||
# the Free Software Foundation, either version 3 of the License, or # |
|||
# (at your option) any later version. # |
|||
# # |
|||
# This program is distributed in the hope that it will be useful, # |
|||
# but WITHOUT ANY WARRANTY; without even the implied warranty of # |
|||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # |
|||
# GNU General Public License for more details. # |
|||
# # |
|||
# You should have received a copy of the GNU General Public License # |
|||
# along with this program. If not, see <http://www.gnu.org/licenses/>. # |
|||
######################################################################### |
|||
# https://borgbackup.readthedocs.io/en/stable/deployment/automated-local.html |
|||
# 0.2.0 |
|||
PURPOSE="SYSTEM" |
|||
TARGET_HOST="" |
|||
LOCATION="/tank/borg/" |
|||
BORG_REPO="${HOSTNAME}" |
|||
TARGET="${TARGET_HOST}${LOCATION}${BORG_REPO}" |
|||
ARC_NAME="${HOSTNAME}+${USER}:$(date +"%Y%m%dT%H%M%S")" |
|||
BORG_COMMENT="Automated \"${PURPOSE}\" backup to repository \"${BORG_REPO}\" at \"${TARGET_HOST}${LOCATION}\" issued $(date +"%Y-%m-%dT%H:%M:%S")." |
|||
BORG_OPTS="--paths-from-stdin --compression auto,lzma,9 --checkpoint-interval 900 --warning" |
|||
LOGFILE_LOCATION="/tmp" |
|||
LOGFILE="borg-${PURPOSE}_$(date +"%Y%m%dT%H%M%S").log" |
|||
export BORG_RELOCATED_REPO_ACCESS_IS_OK=yes |
|||
export BORG_UNKNOWN_UNENCRYPTED_REPO_ACCESS_IS_OK=yes |
|||
borg create ${BORG_OPTS} \ |
|||
--comment "${BORG_COMMENT}" \ |
|||
--exclude /media \ |
|||
--exclude /dev \ |
|||
--exclude /run \ |
|||
--exclude /tmp \ |
|||
--exclude /sys \ |
|||
--exclude /proc \ |
|||
--exclude /mnt \ |
|||
--exclude /tank \ |
|||
--exclude /extusb \ |
|||
--exclude /var/log \ |
|||
"${TARGET}::${ARC_NAME}" \ |
|||
< /home/pi/borg_dirs.txt |
|||
|
|||
|
|||
# 2>> "${LOGFILE_LOCATION}/${LOGFILE}" |
|||
|
|||
sync |
@ -0,0 +1,33 @@ |
|||
#!/bin/bash |
|||
######################################################################### |
|||
# Copyright (C) 2020 Akito <the@akito.ooo> # |
|||
# # |
|||
# This program is free software: you can redistribute it and/or modify # |
|||
# it under the terms of the GNU General Public License as published by # |
|||
# the Free Software Foundation, either version 3 of the License, or # |
|||
# (at your option) any later version. # |
|||
# # |
|||
# This program is distributed in the hope that it will be useful, # |
|||
# but WITHOUT ANY WARRANTY; without even the implied warranty of # |
|||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # |
|||
# GNU General Public License for more details. # |
|||
# # |
|||
# You should have received a copy of the GNU General Public License # |
|||
# along with this program. If not, see <http://www.gnu.org/licenses/>. # |
|||
######################################################################### |
|||
# https://borgbackup.readthedocs.io/en/stable/deployment/automated-local.html |
|||
# 0.2.0 |
|||
PURPOSE="SYSTEM" |
|||
TARGET_HOST="" |
|||
LOCATION="/tank/borg" |
|||
BORG_REPO="${HOSTNAME}" |
|||
ARC_NAME="${HOSTNAME}+${USER}:$(date +"%Y%m%dT%H%M%S")" |
|||
BORG_COMMENT="Automated \"${PURPOSE}\" backup to repository \"${BORG_REPO}\" at \"${TARGET_HOST}${LOCATION}\" issued $(date +"%Y-%m-%dT%H:%M:%S")." |
|||
BORG_OPTS="--keep-within 15d" |
|||
LOGFILE_LOCATION="/tmp" |
|||
LOGFILE="borg-${PURPOSE}_$(date +"%Y%m%dT%H%M%S").log" |
|||
export BORG_RELOCATED_REPO_ACCESS_IS_OK=yes |
|||
export BORG_UNKNOWN_UNENCRYPTED_REPO_ACCESS_IS_OK=yes |
|||
borg prune ${BORG_OPTS} ${LOCATION}/${BORG_REPO} |
|||
|
|||
sync |
@ -0,0 +1,19 @@ |
|||
#! /usr/bin/bash |
|||
#inspired by Sun Knudsen |
|||
|
|||
# create the test files |
|||
echo "preparing tests" |
|||
sysbench fileio --file-total-size=8G prepare > /dev/null |
|||
|
|||
# Test with 16K block size, random read/write |
|||
echo "run test with 16K block size" |
|||
sysbench fileio --file-block-size=16K --file-total-size=8G --file-test-mode=rndrw --threads=$(nproc) run |
|||
|
|||
# Test with 1M block size, random read/write |
|||
echo "run test with 1M block size" |
|||
sysbench fileio --file-block-size=1M --file-total-size=8G --file-test-mode=rndrw --threads=$(nproc) run |
|||
|
|||
# cleanup the test files |
|||
sysbench fileio --file-total-size=8G cleanup |
|||
|
|||
|
@ -0,0 +1,4 @@ |
|||
# !/usr/bin/bash |
|||
|
|||
|
|||
for f in ${1}*.svg; do rsvg-convert "$f" -o "${f%.svg}.png"; done |
@ -0,0 +1,92 @@ |
|||
#!/usr/bin/env bash |
|||
set -euo pipefail |
|||
|
|||
# Dauer des Tests (Default: 10 Minuten, Format z.B. „5m", „600") |
|||
DURATION="${1:-10m}" |
|||
|
|||
# Verzeichnisse / Geräte für File‑IO |
|||
DATA_DRIVE="${HOME}/test/sysbench" # bitte anpassen |
|||
SYSTEM_DRIVE="/mnt/nextcloud/test/sysbench" # bitte anpassen |
|||
CURRENT_DIR=$(pwd) |
|||
|
|||
# Größe und Einstellungen für sysbench-File‑IO |
|||
FILE_TOTAL_SIZE="1G" |
|||
FILE_NUM="4" |
|||
TEST_MODE="rndrw" |
|||
EXTRA_FLAGS="--file-extra-flags=direct" |
|||
|
|||
echo "== Vorbereitung: File‑IO Testdateien erstellen ==" |
|||
echo "testmode=${TEST_MODE}" |
|||
|
|||
cd ${DATA_DRIVE} |
|||
echo "preparing sysbench on ${DATA_DRIVE}" |
|||
sysbench fileio \ |
|||
--file-total-size=${FILE_TOTAL_SIZE} \ |
|||
--file-num=${FILE_NUM} \ |
|||
--file-test-mode=${TEST_MODE} \ |
|||
${EXTRA_FLAGS} \ |
|||
prepare & |
|||
cd ${SYSTEM_DRIVE} |
|||
echo "preparing sysbench on ${SYSTEM_DRIVE}" |
|||
sysbench fileio \ |
|||
--file-total-size=${FILE_TOTAL_SIZE} \ |
|||
--file-num=${FILE_NUM} \ |
|||
--file-test-mode=${TEST_MODE} \ |
|||
${EXTRA_FLAGS} \ |
|||
prepare |
|||
wait |
|||
echo "== Vorbereitung fertig, starte Stresstest für ${DURATION} ==" |
|||
|
|||
# CPU‑Stresstest |
|||
echo "running stress-ng" |
|||
stress-ng \ |
|||
--cpu 8 \ |
|||
--cpu-method all \ |
|||
--verify \ |
|||
--timeout ${DURATION} \ |
|||
--metrics-brief \ |
|||
> stress-ng.log & |
|||
|
|||
# File‑IO auf System-Laufwerk |
|||
cd ${SYSTEM_DRIVE} |
|||
echo "running sysbench on ${SYSTEM_DRIVE}" |
|||
sysbench fileio \ |
|||
--file-total-size=${FILE_TOTAL_SIZE} \ |
|||
--file-num=${FILE_NUM} \ |
|||
--file-test-mode=${TEST_MODE} \ |
|||
${EXTRA_FLAGS} \ |
|||
--file-dir=${DATA_DRIVE} \ |
|||
--time=10 run \ |
|||
> sysbench-nvme.log & |
|||
|
|||
# File‑IO auf Daten-Laufwerk |
|||
cd ${DATA_DRIVE} |
|||
echo "running sysbench on ${DATA_DRIVE}" |
|||
sysbench fileio \ |
|||
--file-total-size=${FILE_TOTAL_SIZE} \ |
|||
--file-num=${FILE_NUM} \ |
|||
--file-test-mode=${TEST_MODE} \ |
|||
${EXTRA_FLAGS} \ |
|||
--file-dir=${SYSTEM_DRIVE} \ |
|||
--time=10 run \ |
|||
> sysbench-sata.log & |
|||
|
|||
# Auf alle Hintergrund‐Jobs warten |
|||
wait |
|||
|
|||
echo "== Stresstest abgeschlossen ==" |
|||
echo "Ergebnisse:" |
|||
echo " - CPU (stress-ng): see stress-ng.log" |
|||
echo " - NVMe (sysbench): see sysbench-nvme.log" |
|||
echo " - SATA (sysbench): see sysbench-sata.log" |
|||
|
|||
# Clean up File‑IO Testdateien |
|||
echo "== Aufräumen: File‑IO Testdateien löschen ==" |
|||
cd ${DATA_DRIVE} |
|||
sysbench fileio ${EXTRA_FLAGS} cleanup |
|||
cd ${SYSTEM_DRIVE} |
|||
sysbench fileio ${EXTRA_FLAGS} cleanup |
|||
cd ${CURRENT_DIR} |
|||
|
|||
echo "Fertig." |
|||
|
@ -0,0 +1,11 @@ |
|||
#!/usr/bin/env bash |
|||
|
|||
sudo apt install python3 python3-dev python3-setuptools python3-wheel python3-pip libssl-dev openssl libacl1-dev libacl1 build-essential libfuse-dev fuse pkg-config ssh |
|||
sudo pip3 install borgbackup[fuse] |
|||
mkdir /tank/borg/${HOSTNAME} |
|||
cd /tank/borg |
|||
borg --verbose init --encryption=none $HOSTNAME |
|||
borg --verbose --progress create --stats --comment "Initial backup" /tank/borg/$HOSTNAME/::firstbackup /home/$USER |
|||
|
|||
|
|||
|
@ -0,0 +1,16 @@ |
|||
#! /bin/bash |
|||
|
|||
cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq |
|||
vcgencmd measure_temp |
|||
echo -n "Fan-Speed beim Start: " |
|||
cat /sys/devices/platform/cooling_fan/hwmon/hwmon2/fan1_input |
|||
|
|||
sysbench cpu --cpu-max-prime=1000 --threads=4 run >/dev/null 2>&1 |
|||
|
|||
cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq |
|||
|
|||
sysbench cpu --cpu-max-prime=50000 --threads=4 run |
|||
cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq |
|||
vcgencmd measure_temp |
|||
echo -n "Fan-Speed am Ende: " |
|||
cat /sys/devices/platform/cooling_fan/hwmon/hwmon2/fan1_input |
@ -0,0 +1,15 @@ |
|||
#!/usr/bin/env bash |
|||
|
|||
bramble=(quimby hans willie kirk brandine) |
|||
|
|||
|
|||
for host in "${bramble[@]}" |
|||
do |
|||
ping -c 3 ${host} |
|||
done |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
@ -0,0 +1,14 @@ |
|||
#!/usr/bin/env bash |
|||
# from ansible/resources |
|||
|
|||
mkdir -p /tank/stressberry/${HOSTNAME} |
|||
cd /tank/stressberry/${HOSTNAME} |
|||
|
|||
SRUN=$(which stressberry-run) |
|||
SPLOT=$(which stressberry-plot) |
|||
|
|||
echo "Aufruf ${SRUN}" |
|||
${SRUN} -n "${HOSTNAME}" -d 1800 -i 300 -c 4 ${HOSTNAME}.out |
|||
echo "Aufruf ${SPLOT}" |
|||
${SPLOT} ${HOSTNAME}.out -f -d 300 -f -l 400 3100 -t 25 90 -o ${HOSTNAME}.png --not-transparent |
|||
|
@ -0,0 +1,10 @@ |
|||
cpu=$(</sys/class/thermal/thermal_zone0/temp) |
|||
|
|||
vccmd=$(which vcgencmd) |
|||
gpu=$(${vccmd} measure_temp) |
|||
gpu=$(echo "${gpu}"| sed 's|temp\=||g') |
|||
|
|||
echo "$(date) @ $(hostname)" |
|||
echo "-------------------------------------------" |
|||
echo "GPU => ${gpu}" |
|||
echo "CPU => $((cpu/1000))'C" |
@ -0,0 +1,77 @@ |
|||
#!/usr/bin/env bash |
|||
set -euo pipefail |
|||
|
|||
# Dauer des Tests (Default: 10 Minuten, Format z.B. "5m", "600") |
|||
DURATION="${1:-10m}" |
|||
|
|||
# Verzeichnisse / Geräte für File‑IO |
|||
NVME_MOUNT="~/test" # bitte anpassen |
|||
SATA_MOUNT="/mnt/nextcloud/test" # bitte anpassen |
|||
|
|||
# Größe und Einstellungen für sysbench-File‑IO |
|||
FILE_TOTAL_SIZE="1G" |
|||
FILE_NUM="4" |
|||
TEST_MODE="rndrw" |
|||
EXTRA_FLAGS="--file-extra-flags=direct" |
|||
|
|||
echo "== Vorbereitung: File‑IO Testdateien erstellen ==" |
|||
sysbench fileio \ |
|||
--file-total-size=${FILE_TOTAL_SIZE} \ |
|||
--file-num=${FILE_NUM} \ |
|||
--file-test-mode=${TEST_MODE} \ |
|||
${EXTRA_FLAGS} \ |
|||
--file-dir=${NVME_MOUNT} prepare & |
|||
sysbench fileio \ |
|||
--file-total-size=${FILE_TOTAL_SIZE} \ |
|||
--file-num=${FILE_NUM} \ |
|||
--file-test-mode=${TEST_MODE} \ |
|||
${EXTRA_FLAGS} \ |
|||
--file-dir=${SATA_MOUNT} prepare & |
|||
wait |
|||
echo "== Vorbereitung fertig, starte Stresstest für ${DURATION} ==" |
|||
|
|||
# CPU‑Stresstest |
|||
stress-ng \ |
|||
--cpu 8 \ |
|||
--cpu-method all \ |
|||
--verify \ |
|||
--timeout ${DURATION} \ |
|||
--metrics-brief \ |
|||
> stress-ng.log 2>&1 & |
|||
|
|||
# File‑IO auf NVMe |
|||
sysbench fileio \ |
|||
--file-total-size=${FILE_TOTAL_SIZE} \ |
|||
--file-num=${FILE_NUM} \ |
|||
--file-test-mode=${TEST_MODE} \ |
|||
${EXTRA_FLAGS} \ |
|||
--file-dir=${NVME_MOUNT} \ |
|||
--time=${DURATION} run \ |
|||
> sysbench-nvme.log 2>&1 & |
|||
|
|||
# File‑IO auf SATA‑SSD |
|||
sysbench fileio \ |
|||
--file-total-size=${FILE_TOTAL_SIZE} \ |
|||
--file-num=${FILE_NUM} \ |
|||
--file-test-mode=${TEST_MODE} \ |
|||
${EXTRA_FLAGS} \ |
|||
--file-dir=${SATA_MOUNT} \ |
|||
--time=${DURATION} run \ |
|||
> sysbench-sata.log 2>&1 & |
|||
|
|||
# Auf alle Hintergrund‐Jobs warten |
|||
wait |
|||
|
|||
echo "== Stresstest abgeschlossen ==" |
|||
echo "Ergebnisse:" |
|||
echo " - CPU (stress-ng): see stress-ng.log" |
|||
echo " - NVMe (sysbench): see sysbench-nvme.log" |
|||
echo " - SATA (sysbench): see sysbench-sata.log" |
|||
|
|||
# Clean up File‑IO Testdateien |
|||
echo "== Aufräumen: File‑IO Testdateien löschen ==" |
|||
sysbench fileio ${EXTRA_FLAGS} --file-dir=${NVME_MOUNT} cleanup |
|||
sysbench fileio ${EXTRA_FLAGS} --file-dir=${SATA_MOUNT} cleanup |
|||
|
|||
echo "Fertig." |
|||
|
@ -0,0 +1,21 @@ |
|||
# System-Updater CC-BY Olli Graf |
|||
# V 1.6 2019 |
|||
|
|||
VERSION="1.7" |
|||
TMPFILE="/tmp/updater.txt" |
|||
|
|||
echo "Updater V ${VERSION}" |
|||
sudo rm -f ${TMPFILE} |
|||
sudo apt-get update |
|||
sudo apt-get dist-upgrade -y --allow-unauthenticated |tee ${TMPFILE} |
|||
sudo snap refresh |
|||
sudo apt-get autoremove -y |
|||
if grep -q linux-header ${TMPFILE}; then |
|||
echo "reboot nötig" |
|||
read -n1 -p "Neustart? (J/N)" auswahl |
|||
if [ "${auswahl}" == "j" ]; then |
|||
echo "System wird gestartet." |
|||
sudo reboot |
|||
fi |
|||
|
|||
fi |
@ -0,0 +1,47 @@ |
|||
- include_tasks: ../subtasks/upgrade.yml |
|||
|
|||
- name: create home dirs |
|||
file: |
|||
path: ~/{{ item}} |
|||
state: directory |
|||
loop: |
|||
- bin |
|||
- git |
|||
|
|||
- name: copy scripts |
|||
copy: |
|||
src: {{ item }} |
|||
dest: /home/pi/bin |
|||
mode: '0755' |
|||
loop: "{{ query('fileglob', 'scripts/*') }}" |
|||
|
|||
- name: copy resources to ~ |
|||
copy: |
|||
src: {{ item }} |
|||
dest: /home/pi |
|||
loop: "{{ query('fileglob', 'resources/*') }}" |
|||
|
|||
- name: create nextcloud dirs |
|||
file: |
|||
path: ~/{{ item}} |
|||
state: directory |
|||
loop: "{{ ncdirs }}" |
|||
|
|||
- name: Add Nextcloud mount to fstab |
|||
ansible.builtin.blockinfile: |
|||
path: /etc/fstab |
|||
marker: "# {mark} ANSIBLE MANAGED BLOCK nextcloud" |
|||
block: | |
|||
PARTUUID={ partuuid }}} /mnt/nextcloud ext4 defaults,noatime 0 1 |
|||
|
|||
- name: Clone docker-compose repository |
|||
ansible.builtin.git: |
|||
repo: 'https://git.olli-cloud.de/olli/dockercmd' |
|||
dest: /home/pi/git |
|||
version: master |
|||
|
|||
- name: Run docker-compose up |
|||
community.docker.docker_compose: |
|||
project_src: '/home/pi/git/dockercmd/compose/nextcloud' |
|||
state: present |
|||
become: true |
@ -0,0 +1,12 @@ |
|||
ncdirs: |
|||
- /mnt/nextcloud/nextcloud/apps |
|||
- /mnt/nextcloud/nextcloud/html |
|||
- /mnt/nextcloud/nextcloud//data |
|||
- /nextcloud/nextcloud/config |
|||
- /opt/clamav |
|||
- /opt/grafana |
|||
- /opt/influxdb |
|||
|
|||
partuuid: |
|||
- 6b61b9cb-01 |
|||
|
@ -0,0 +1,38 @@ |
|||
- name: Mount /mnt/nextcloud |
|||
become: true |
|||
|
|||
- name: create nextcloud dirs |
|||
become: true |
|||
file: |
|||
path: {{ item }} |
|||
state: directory |
|||
owner: pi |
|||
group: pi |
|||
mode: '0755' |
|||
loop: |
|||
- /mnt/nextcloud |
|||
- /mnt/nextclod/apps |
|||
- /mnt/nextcloud/html |
|||
- /mnt/nextcloud/data |
|||
|
|||
- name: create clamav dir |
|||
become: true |
|||
file: |
|||
path: /opt/clamav |
|||
state: directory |
|||
owner: pi |
|||
group: pi |
|||
mode: '0755' |
|||
|
|||
- name: Add Nextcloud mount to fstab |
|||
ansible.builtin.blockinfile: |
|||
path: /etc/fstab |
|||
marker: "# {mark} ANSIBLE MANAGED BLOCK nextcloud" |
|||
block: | |
|||
PARTUUID=6b61b9cb-01 /mnt/nextcloud ext4 defaults,noatime 0 1 |
|||
|
|||
ansible.posix.mount: |
|||
path: /mnt/nextcloud |
|||
state: mounted |
|||
fstype: ext4 |
|||
src: PARTUUID=6b61b9cb-01 |
@ -0,0 +1,3 @@ |
|||
--- |
|||
|
|||
- include_tasks: ../subtasks/shutdown.yml |
@ -0,0 +1,3 @@ |
|||
--- |
|||
- name: Shutting down |
|||
community.general.shutdown: |
@ -0,0 +1,18 @@ |
|||
- name: backup keys file |
|||
become: false |
|||
ansible.builtin.copy: |
|||
src: "/home/pi/.ssh/authorized_keys" |
|||
dest: "/home/pi/.ssh/authorized_keys.bak" |
|||
remote_src: yes |
|||
owner: pi |
|||
group: pi |
|||
mode: '0644' |
|||
|
|||
|
|||
- name: install key |
|||
become: false |
|||
ansible.posix.authorized_key: |
|||
user: "pi" |
|||
state: present |
|||
# exclusive: yes |
|||
key: "{{ lookup('file', '/home/olli/.ssh/id_ed25519.pub') }}" |
@ -1,2 +1,4 @@ |
|||
- include: ../subtasks/upgrade.yml |
|||
- include: ../subtasks/reboot.yml |
|||
--- |
|||
|
|||
- include_tasks: ../subtasks/upgrade.yml |
|||
- include_tasks: ../subtasks/reboot.yml |
|||
|
@ -0,0 +1,7 @@ |
|||
--- |
|||
- hosts: "{{ target }}" |
|||
gather_facts: false |
|||
remote_user: pi |
|||
roles: |
|||
- shutdown |
|||
|
@ -0,0 +1,61 @@ |
|||
--- |
|||
|
|||
- name: Check Y2K38 readiness on Raspberry Pis |
|||
hosts: "{{ target }}" |
|||
gather_facts: yes |
|||
tasks: |
|||
- name: "Setze mind. Kernelversion" |
|||
ansible.builtin.set_fact: |
|||
current_version: 5.6 |
|||
|
|||
- name: Check architecture |
|||
command: uname -m |
|||
register: arch_check |
|||
changed_when: false |
|||
|
|||
- name: Ensure architecture is aarch64 |
|||
fail: |
|||
msg: "System is not aarch64. Y2K38 safety cannot be guaranteed." |
|||
when: arch_check.stdout != "aarch64" |
|||
|
|||
- name: Check kernel version |
|||
command: uname -r |
|||
register: kernel_check |
|||
changed_when: false |
|||
- debug: |
|||
var: kernel_check |
|||
|
|||
- name: Ensure kernel version is >= 5.6 |
|||
fail: |
|||
msg: "Kernel version is less than 5.6. Update the kernel to ensure Y2K38 safety." |
|||
when: current_version is version(latest_version, '>') |
|||
when: (kernel_check.stdout | regex_search('^(\d+)\.(\d+)', '\\1.\\2') | float) < 5.6 |
|||
|
|||
- name: Check glibc version |
|||
command: ldd --version |
|||
register: glibc_check |
|||
changed_when: false |
|||
|
|||
- name: Ensure glibc version is >= 2.28 |
|||
fail: |
|||
msg: "glibc version is less than 2.28. Update glibc to ensure Y2K38 safety." |
|||
when: > |
|||
glibc_check.stdout_lines[0] is search(".*(\d+)\.(\d+).*") |
|||
and |
|||
((glibc_check.stdout_lines[0] | regex_replace('.*(\d+)\.(\d+).*', '\\1.\\2') | float) < 2.28) |
|||
|
|||
- name: Test future timestamp with date |
|||
command: date -d @2147483648 |
|||
register: date_check |
|||
changed_when: false |
|||
|
|||
- name: Ensure future timestamp works correctly |
|||
fail: |
|||
msg: "Date command failed to handle timestamps beyond 2038. Y2K38 safety is not guaranteed." |
|||
when: "'2038-01-19' not in date_check.stdout" |
|||
|
|||
- name: Ensure system is up-to-date |
|||
apt: |
|||
update_cache: yes |
|||
upgrade: dist |
|||
|
@ -0,0 +1,7 @@ |
|||
--- |
|||
- hosts: "{{ target }}" |
|||
gather_facts: false |
|||
remote_user: pi |
|||
roles: |
|||
- update-sshkey |
|||
|
Loading…
Reference in new issue