You are here: Home Linux Shell/Bash Programmierung MyScripts Checks if the mailqueue is empty
Search
Advanced Search…
E-Mail

Webmail: webmail.wyden.com

E-Mail Preferences: postfix.wyden.com/users

E-Mail Administration: postfix.wyden.com

Statistics
Total: 473
Total Pages: 286
Total Folders: 87
Total Files: 18
Total Links: 26
Last modification: 19.04.2012 15:21
 

Checks if the mailqueue is empty

by Wyden Silvan last modified 11.11.2009 12:05

#!/bin/sh
#script that looks if the mailqueue is emtpy or not. if the queue is empty, nothing happens. If not an e-amil with the queue is send.
mailq > /root/temp

if [ `cat /root/temp | wc -m` -gt 4 ]
then
        #send an e-mail if the queue isn't empty
        sendmail mymail@example.com < /root/temp
fi

rm -rf /root/temp