$user = apache

ps u -u $user | awk '{total+=$3}END{print total}'