I have a perl application.In one of the low level scripts, it's possible that it must "logout" the user.Basically, exit the shell that this application is running. Are there Any ideas on how to accomplish this?

5 Years
Discussion Span
Last Post by rch1231

This is just off the top of my head mind you but you can determine the parent process id of the perl script via getppid
You could use this to kill the login shell.

kill 'STOP', getppid;

From a Perl Manual:

kill LIST
This function sends a signal to a list of processes. The first element of the list must be the signal to send.
You may use a signal name in quotes (without a SIG on the front). The function returns the number of
processes successfully signaled. If the signal is negative, the function kills process groups instead of
processes. (On System V, a negative process number will also kill process groups, but that's not
portable.) Examples:
$cnt = kill 1, $child1, $child2;
kill 9, @goners;
kill 'STOP', getppid; # Can *so* suspend my login shell...
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.