Finding who is using dovecot’s imap process in the process table

Ever want to know who has what imap-login ? Then run something along these lines

for i in $(ps -ef | awk '/[i]map$/ {print $2}'); do
      echo "$(lsof -p $i | awk '/cwd/ {print $9}') is handled by process id $i" ;
done

Which returns something along these lines (names changed to protect the innocent ;) .

$PATHTOVPOPMAIL/domains/$DOMAIN/$USER is handled by process id 1277

Just a quick lunch time hack that might help some errant google searcher.

Leave a Reply