During troubleshooting, it may be helpful to monitor the number of process instances to see if it is stable or increasing.
The following command will display the number of occurrences of sendmail processes every 5 seconds in Bourne shell derivatives (i.e., sh, ksh, bash…):
while true
do
ps -ef | grep [s]endmail | wc -l
sleep 5
done
Using a loop from the command line is a powerful tool. When you press ENTER at the end of each line, you will be presented with a different prompt based on your shell indicating that it is continuing the command and waiting for more.
The [s] in sendmail represents a regular expression trick that means match any single character within the square brackets. This means that [s]endmail will match only sendmail and will prevent counting the grep command in the ps -ef listing because it will show up as [s]endmail.
You can vary the parameter to sleep to increase or decrease the number of seconds between each counting.