Discussion Locked

Unix Log off using menu script

0 helpful
7 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.
I have a sco unix server. Our main software program runs off of this server. I have been asked to create a menu system to make the use by the employees easier. I have everything configured except for a way to have the users log off using the menu. I use the exit command and it exits the script. I was wondering if anyone knows a way to log off the user with a script command? Thanks Kyle

7 replies

by spellbinder

try using 'kill -9 -1' in the script - this is a bit too harsh, but will get your job done.
this command is used to kill all the processes (but here it works only on the ones which can be controlled by the user), and so be careful not to run this as root!

or a less cruel way is to find out the PID of the shell in which the user is working, through a ps command and then giving 'kill -9 PIDofSHELL'.

these will not allow for a so-called 'graceful exit', but i assume that users are using telnet/dumb terminals to connect and you kill the processes only after the user has performed all the jobs. hope this helps.

by kyle

This works but it is kind of harsh. I found for remote users this worked.

by alveden

I am assuming that your users are accessing the script through some form of remote login - telnet, rlogin, ssh.

If so, you can create a script that look something like this

#!/bin/sh
/[Path to menu script]/[menu script
exit 0

Replace users login shell in /etc/passwd with this new script. You might also want to add a change password options in your menu script.

This discussion is closed to new replies.