Author Topic: [Bash] mailq Alternative via find  (Read 1411 times)

p

  • Global Moderator
  • Apache
  • *****
  • Posts: 110
  • Karma: +27/-0
    • View Profile
[Bash] mailq Alternative via find
« on: February 07, 2014, 10:53:31 am »
mailq -> Drei Kaffee
mailq | grep Requests -> Zwei Kaffee
mailq | tail -n 1 -> Ein Kaffee

Code: [Select]
#!/bin/sh
qdir=`postconf -h queue_directory`
incoming=`find $qdir/incoming -type f -print | wc -l | awk '{print $1}'`
activeonly=`find $qdir/active -type f -print | wc -l | awk '{print $1}'`
maildrop=`find $qdir/maildrop -type f -print | wc -l | awk '{print $1}'`
active=`find $qdir/incoming $qdir/active $qdir/maildrop -type f -print | wc -l | awk '{print $1}'`
deferred=`find $qdir/deferred -type f -print | wc -l | awk '{print $1}'`
printf "active: %d\ndeferred: %d\nincoming: %d\nactiveonly: %d\nmaildrop: %d\n" $active $deferred $incoming $activeonly $maildrop
echo "$active+$deferred+$incoming+$maildrop" | bc

Instant.  :ugly2;

DarthShredder

  • Global Moderator
  • Immernoch zu viel RL
  • *****
  • Posts: 28
  • Karma: +10/-0
    • View Profile
Re: [Bash] mailq Alternative via find
« Reply #1 on: February 07, 2014, 10:55:49 am »
 :ugly; gut, wenn man ├╝ber 10000 Mails in der Schleife hat.   8)