From 18a07247d057437213aac27b585a00775acfbcf1 Mon Sep 17 00:00:00 2001 From: marcel-dempers Date: Sat, 29 Mar 2025 13:24:23 +1100 Subject: [PATCH] test files --- .../monitoring/disk/.test/app_logger_disk.sh | 26 +++++++++++++++++++ .../.test/tcp_client_sendandconnect.sh | 4 +++ .../.test/tcp_client_sendconcurrent.sh | 8 ++++++ .../monitoring/network/.test/tcp_server.sh | 4 +++ 4 files changed, 42 insertions(+) create mode 100644 course/content/operating-systems/linux/monitoring/disk/.test/app_logger_disk.sh create mode 100644 course/content/operating-systems/linux/monitoring/network/.test/tcp_client_sendandconnect.sh create mode 100644 course/content/operating-systems/linux/monitoring/network/.test/tcp_client_sendconcurrent.sh create mode 100644 course/content/operating-systems/linux/monitoring/network/.test/tcp_server.sh diff --git a/course/content/operating-systems/linux/monitoring/disk/.test/app_logger_disk.sh b/course/content/operating-systems/linux/monitoring/disk/.test/app_logger_disk.sh new file mode 100644 index 0000000..cebd950 --- /dev/null +++ b/course/content/operating-systems/linux/monitoring/disk/.test/app_logger_disk.sh @@ -0,0 +1,26 @@ +#!/bin/bash + +# Directory to create large files in +TARGET_DIR="/var/log/app_logs" +mkdir -p "$TARGET_DIR" + +# Number of files to create +NUM_FILES=1000 + +# Size of each file in MB +FILE_SIZE_MB=1 + +# Create large files +for i in $(seq 1 $NUM_FILES); do + TIME=$(date +%YYYY%m%d%H%M%s%N) + mkdir -p "$TARGET_DIR/$TIME" + dd if=/dev/zero of="$TARGET_DIR/$TIME/app_${i}.log" bs=1M count=$FILE_SIZE_MB +done + +# Wait for all background processes to finish +wait + +#give time to troubleshoot +sleep 60 + +echo "Disk usage simulation complete. Large files created in $TARGET_DIR." \ No newline at end of file diff --git a/course/content/operating-systems/linux/monitoring/network/.test/tcp_client_sendandconnect.sh b/course/content/operating-systems/linux/monitoring/network/.test/tcp_client_sendandconnect.sh new file mode 100644 index 0000000..dc056ec --- /dev/null +++ b/course/content/operating-systems/linux/monitoring/network/.test/tcp_client_sendandconnect.sh @@ -0,0 +1,4 @@ +#!/bin/bash +# Connect to the TCP server on localhost port 12345 +echo "Connecting to TCP server on localhost port 12345..." +echo "Sending one message and holding connection!" | nc localhost 12345 \ No newline at end of file diff --git a/course/content/operating-systems/linux/monitoring/network/.test/tcp_client_sendconcurrent.sh b/course/content/operating-systems/linux/monitoring/network/.test/tcp_client_sendconcurrent.sh new file mode 100644 index 0000000..b419b23 --- /dev/null +++ b/course/content/operating-systems/linux/monitoring/network/.test/tcp_client_sendconcurrent.sh @@ -0,0 +1,8 @@ +#!/bin/bash + +echo "Connecting to TCP server on localhost port 12345..." + +echo "Sending messages one after another!" +while true; do + echo "Sending message and closing connection!" | nc -q 5 localhost 12345 +done \ No newline at end of file diff --git a/course/content/operating-systems/linux/monitoring/network/.test/tcp_server.sh b/course/content/operating-systems/linux/monitoring/network/.test/tcp_server.sh new file mode 100644 index 0000000..87ac491 --- /dev/null +++ b/course/content/operating-systems/linux/monitoring/network/.test/tcp_server.sh @@ -0,0 +1,4 @@ +#!/bin/bash + +echo "Starting TCP server on port 12345..." +nc -lk 12345 \ No newline at end of file