I've been working on creating a script to scan a series of mailboxes on a linux server, find ones that have more than 250 emails in the mailbox, and then send an email with the name of those mailboxes and how much mail each of them have.

Here is my mailboxcounter script to perform that:

```
ls /path to mailboxes/ -lR | grep rw | awk '{count[$3]++} END {for (word in count) if (count[word] > 250) print word, count[word]}'

```

Then I've attempted to create a cronjob in order to send out an email containing the mailboxes that match the criteria of the script on a regular schedule. I've set it to run every 5 min now just for testing purposes.

Here is that cronjob:

```
*/5 * * * * /usr/sbin/sendmail name@email.com < <( bash /path/mailboxcounter.sh ) >/dev/null 2>&1

```

The first time I ran the cronjob, it worked flawlessly, but it never sent any other emails after the first one, let alone every 5 min. Additionally, I tried to add a few strings to clean up my original script like below:

```
ls /path to mailboxes/ -lR | grep rw | awk '{count[$3]++} END {for (word in count) if (count[word] > 25) print "Name: " word",", "emails in mailbox: " count[word]}'

```

But with these added strings, the cronjob won't send any emails anymore.

I've tried using the mail command and confirmed that mailx is installed on the server, but it never seems to work at all, so I've been sticking to using sendmail.

What am I missing here and how can I fix it so the cronjob will send the emails on a regular schedule while also adding the more descriptive strings to my original script without it failing to send emails? I feel like I'm close but have been failing with trial and error. Any help at all would be much appreciated.