Operating System - HP-UX
1827894 Members
1959 Online
109969 Solutions
New Discussion

How to logout from the login session through a script ?

 
SOLVED
Go to solution
Nisar Ahmad
Regular Advisor

How to logout from the login session through a script ?

Hi There

We are running some login session on client sides to execute autamated scripts. I wander how could we can logout from the sessions through the scripts rather than typing exit.

Thanks in advance

Nisar
4 REPLIES 4
Michael Tully
Honored Contributor

Re: How to logout from the login session through a script ?

Hi,

The easiest way would be to run the script through nohup. That way you could login, start the script and log out and check later.

# nohup /usr/local/bin/myscript &

HTH
-Michael
Anyone for a Mutiny ?
Trond Haugen
Honored Contributor
Solution

Re: How to logout from the login session through a script ?

If the purpose is to start a script and not get back to the shell when finished you can exec it.

$ cat xx
echo "This script will be exec'ed"
echo BYE
$ exec xx
Connection to host lost.

Regards,
Trond
Regards,
Trond Haugen
LinkedIn
Steve Steel
Honored Contributor

Re: How to logout from the login session through a script ?

Hi

If it is only a script then put your script as the login program like this
name:passwd:416:40:Details:home:/tmp/yoyo

and declare your shell in the script like this

Program /tmp/yoyo

#!/bin/ksh
read a
if [ "$a" = "y" ]
then
echo ok
fi
ps -ef
exit

Steve Steel
If you want truly to understand something, try to change it. (Kurt Lewin)
Deepak Extross
Honored Contributor

Re: How to logout from the login session through a script ?