I need to exit from the current session and I am using the following code:

```
read -p "Do you want to start a new session? [Y/N] " usr_session
if [ "$usr_session" == "y" ] || [ "$usr_session" == "Y" ]; then
   echo -e "`date`\t\t Exiting...\n You will need to login back...\n" >> $LOG_FILE
   echo -e "Exiting...\n You will need to login back...\n"
   sleep 5
   curr_usr=`whoami`
   pkill -9 -u $curr_usr
elif [ "$usr_session" == "n" ] || [ "usr_session" == "N" ]; then
    echo -e "You are still in the same session.\n"
else
    echo "Invalid input"
fi

```

Is there a better approach to perform the same but in more graceful manner? I feel the killing the current user process might not be safe. Any suggestions are really appreciated.

Thanks in advance.