Disconnect modem when postfix queue empty
This script code checks to see if the postfix mail queue empty and if true it disconnects my modem.
#!/bin/sh postqueue -p|grep empty if [ $? -eq 0 ]; then killall wvdial fi
I need to run it many times as needed until the mail queue gets empty.
How can I loop it?
Maybe placing an else that returns to execute the script from the line of postqueue -p|grep empty ?
I know it can be simple but am not too much expert in bash scripting so I need help to complete this code.