View Single Post
Old 7th November 2011, 19:08
nerdhacker nerdhacker is offline
Junior Member
Join Date: Nov 2011
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Lightbulb How to disconnect modem when postfix queue empty??

in /etc/ppp/ip-up.d/script I have the following that runs fetchmail when the ppp0 interface is up (connected) and when it finish the modem ends internet conection automatically.

 /usr/bin/fetchmail -v -f /etc/fetchmailrc -L /var/log/fetchmail.log
 killall wvdial
this works perfectly. now i need to add to the script below the fetchmail command execution something that checks if the mail queue of postfix is completely empty and if is true then execute the command killall wvdial to hangup the modem.

In theory i know i could do something using if, else, do, while, until, etc. but in practice i do not know how to develop it. I would like you guys to help me to program and complete this script to work properly. I appreciate the comments.
Reply With Quote
Sponsored Links