This commit is contained in:
2025-06-09 19:34:56 +09:00
parent 02a10ca391
commit cdc4e209c7
15 changed files with 490 additions and 1 deletions

27
old_scripts/script.sh Normal file
View File

@@ -0,0 +1,27 @@
#!/bin/bash
commands=(
"hostnamectl"
"ip a"
"ip route"
"cat /etc/resolv.conf"
"uptime"
"who"
"df -h"
"free -m"
"netstat -tuln"
"systemctl list-units --type=service --state=running"
)
output_file="/var/log/command_results_$(date +%F_%H-%M-%S).log"
echo "== Сбор информации начат: $(date) ==" > "$output_file"
for cmd in "${commands[@]}"; do
echo "Команда: $cmd" >> "$output_file"
echo "Вывод:" >> "$output_file"
eval "$cmd" >> "$output_file" 2>&1
echo -e "\n$(printf '%0.s-' {1..60})\n" >> "$output_file"
done
echo "== Сбор информации завершен: $(date) ==" >> "$output_file"