Shell script for login user and email

Guys please help me I have a linux class and I want to write a shell script who shows which user loged in and show the process that are active in his/her shell in another text file and email that file to root just when the user loged out
Thanks every bod

Welcome to the forum.

We love to help you with your classwork - if you reopen the thread in the adequate forum, filling in the entire form. Please show your programming environment, what you have tried, and where you are stuck.