From mboxrd@z Thu Jan 1 00:00:00 1970 Message-ID: <96076327921141.tru64-unix-managers.marc@archive.invalid> From: "Mr. Kenneth L. Atchinson" Date: Tue, 09 Jan 1996 19:49:07 +0000 To: tru64-unix-managers Subject: Summary: logout command X-MARC-Message: https://marc.info/?l=tru64-unix-managers&m=96076327921141 Hello Managers, Here is a summary of all of the responses I got for this problem (stated) > If you use the Korn Shell, and have an Korn > Shell written application which performs various tasks including LOGGING > off, there is no "logoff" (logout) command in Korn Shell nor in DEC UNIX. > Performing an "exit" in a ksh script only exits the script. Thus my > users in this script can not logoff the system using the script. Reply from: Donald L. Ritchey Try running the command 'stty 0' to set the baud rate on your tty to 0, effectively sending a hang-up signal to the connected shell and all child processes. Reply From: Jason Neil try setting up aliases for commands. see ksh - alias Reply From: Hannu Paakko You could send hup-signal to the shell process. In .profile set export MPID=$$ logout script: kill -hup $MPID Reply From: Dave Roberts Issuing a `kill 0` should kill the login process for that user. This should work all flavours of Un*x. AIX is fairly unique in having a logout command, it also doesn't exist on SCO, HP or DRS/NX. Reply From: Eric Bennett You could define a function or alias which exec's your script: alias logoff="exec /somepath/logoff" You could do something like this to kill the parent process: set `ps -fp $$` kill -HUP $3 exit ## Never reached? If you are persistent, how about: upkill () { set $1 `ps -o ppid -p $1` if [ 0$3 -gt 1 ]; then upkill $3; fi /bin/kill -HUP $1 2>/dev/null } upkill $$ Of course, this will also try to kill inetd and telnetd. (Shrug) Reply From: Jon Trulson You might try putting a kill -15 0 (or kill -9 0) in your script. PID 0, when passed to a kill command will send that signal to the process group. So doing a kill -9 0 in your script will kill all processes started by the user that are still a part of the user's process group. Reply From: Jason Neil Reply From: msdc!daleb@uunet.uu.net (William D. Blasingame) The 'logout' command is a builtin for csh, and, as you noted, doesn't appear to be there for ksh. The problem you describe might be solved by: - letting the "Korn Shell written application" be the users' login shell (in /etc/passwd). This way, when they exit this shell, they're logged off. - execute the application from the login shell with the 'exec' shell command, thus making the current shell the application and not creating a new (i.e., another) process. Again, when they quit the current shell, they're off. Thanks again from everyone for the responses. =============================================================================== Kenneth Atchinson Baldwin-Wallace College UNIX System Administrator 275 Eastland Rd. katchins@baldwinw.edu Berea, Ohio 44017 Voice: (216) 826-6967 FAX: (216) 826-6545