#!/bin/sh

ACCOUNT="$1"

if [ $# -lt 1 ]; then
	ACCOUNT="-a"
fi

mbsync "$ACCOUNT"
if pgrep -f 'mu server'; then
	emacsclient -e '(mu4e-update-index)'
else
	mu index --lazy-check
fi
