Script command - need help urgently

I have added script command to the .profile of the id, whose session needs to be captured. When exit command is issued, the script command exits.
Is there a way to exit the parent shell also - and log off the system completely with one exit command?

Start the script with exec.

Regards

I am also executing a mail command after the script in the .profile, to send the output of script to the management - more like an audit report.
When exec is used, I find the mail is not sent. Gets terminated. Can someone please help.

Why don't you place an exit command after the mail command?

try this in the .profile:

. the_script

and then this should work in the_script:

date | mailx me
exit

oh.... and there may be something else wrong with the script?

I did this - exec script....in .profile, then placed a mail command and then an exit. There also, when I type an exit, the parent process exits, no mail is being sent.
I removed the exec and tried the same thing. The system just hangs when i type an exit.
Please help!!!

---------- Post updated at 11:39 AM ---------- Previous update was at 11:37 AM ----------

Where do I execute the script command in the .profile? Should I be doing an exec script before executing the_script? Kindly help.

Nothing after the exec happens because the exec command tells the shell to replace itself with the new command.

How can this be accomplished, if exec would prevent the sending out of email. How to send an email within the parent process?

The "exec script" should the last line in the .profile.
It should be full qualified, ie:

/my_full_path/to_said_script/the_script_itself.sh