090600
This commit is contained in:
27
old_scripts/script.sh
Normal file
27
old_scripts/script.sh
Normal 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"
|
||||
Reference in New Issue
Block a user