Un semplice script bash che controlla la coda di postix e ci avverte se supera un determinato limite :
| Bash | | copy code | | ? |
| 01 | #!/bin/bash |
| 02 | limit=50; |
| 03 | notifyemail=luigi.molinaro@gmail.com; |
| 04 | servername=$(hostname); |
| 05 | |
| 06 | queue_p=$(postqueue -p | grep Request | awk '{print $5}'); |
| 07 | |
| 08 | if [ $queue_p -ge $limit ] ; then |
| 09 | echo " |
| 10 | Dear Server admin, |
| 11 | |
| 12 | We have $limit in local mailqueue. |
| 13 | " | mail -s "Mailqueue limit exceeding - $servername" $notifyemail |
| 14 | |
| 15 | fi |
| 16 |