Exemplos de Uso
$
SERVICOS=("nginx" "mysql" "php-fpm")
EMAIL="admin@empresa.com"
$
for S in "${SERVICOS[@]}"; do
if ! systemctl is-active --quiet "$S"; then
systemctl start "$S"
echo "Serviço $S reiniciado em $(hostname) - $(date)" | mail -s "Alerta: $S parou" "$EMAIL"
fi
done
$
df -h | awk "NR>1 {gsub(/%/,""); if ($5 > 85) print $0}" | while read l; do
echo "DISCO: $l" | mail -s "Alerta de Disco" "$EMAIL"
done
$