- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: auto logout
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-11-2009 07:45 AM
02-11-2009 07:45 AM
We are calling an X-windows based application from the .profile via reflection X automatically . Once the user exit out the application , I want to logoff the shell automatically as we don't want them to get the $ prompt at all.
Tried with kill -9 $$ and some thing like
shown below. Buit the $ prompt still remain.How to logout the users automatically after he/she is done with the application?
.profile code to execute the application.
cd /home/somestuff
./run_the_application
./kill_it
--------
kill_it has the following lines
#!/bin/ksh
MYUSER=`whoami`
for MYPID in `ps -ef | grep $MYUSER | awk '{ print $(2) }' | sort -r`
do
`kill -9 $MYPID`
done
Solved! Go to Solution.
- Tags:
- logout
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-11-2009 08:07 AM
02-11-2009 08:07 AM
Re: auto logout
cd /home/somestuff
exec ./run_the_application
"exec" causes "./run_the_application" to
replace the shell, so when it exits, the
process should die.
HP-UX-free example:
ALP $ rsh /user = root sol
Last login: Wed Feb 11 10:04:53 from alp-l.antinode.
Sun Microsystems Inc. SunOS 5.10 Generic January 2005
You have new mail.
sol# pwd
/root
sol# exec pwd
/root
%RSH-S-REMCLOSED, Remote connection closed
ALP $
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-11-2009 08:48 AM
02-11-2009 08:48 AM
Re: auto logout
.profile with exec ./run_the_application
doesn't stopped opening/executing the application from xterm. Then
I have done the following.But its not existing out the $ prompt in the xterm.
.profile :
exec ./call_run
call_run has the following lines.
#!/usr/bin/ksh
exec ./run_the_application
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-11-2009 08:57 AM
02-11-2009 08:57 AM
Re: auto logout
.profile with exec ./run_the_application
stopped opening/executing the application itself from xterm. So I have done the following.But its not existing out the $ prompt in xterm.
.profile :
exec ./call_run
call_run has the following lines.
#!/usr/bin/ksh
exec ./run_the_application
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-11-2009 09:03 AM
02-11-2009 09:03 AM
Re: auto logout
When you exit the application, it will proceed to the next statement in the .profile file and exit out.
cd /home/somestuff
./run_the_application
exit
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-11-2009 09:06 AM
02-11-2009 09:06 AM
Re: auto logout
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-11-2009 09:19 AM
02-11-2009 09:19 AM
Re: auto logout
The 'exit' after the 'run_the_application' should have no effect on the command, UNLESS you are doing a './run_the_application &', in which case the exit will kill the application when the shell exits.
Verify you are not trying to run the command in the background.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-11-2009 09:21 AM
02-11-2009 09:21 AM
Re: auto logout
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-11-2009 10:31 AM
02-11-2009 10:31 AM
Re: auto logout
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-11-2009 11:01 AM
02-11-2009 11:01 AM
Re: auto logout
> in the xterm.
What xterm? I think that you're hiding too
many details. Like who creates an xterm.
If you can provide a sample script which
really does something, then it might be
possible to suggest some changes. With no
information about who creates which process
how, running what, I'm lost.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-11-2009 11:08 AM
02-11-2009 11:08 AM
Re: auto logout
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-11-2009 11:08 AM
02-11-2009 11:08 AM
Re: auto logout
We are using reflection X software.
Reflection x is passing
/usr/bin/X11/xterm -fn 6x13 -sb -ls -display %IP#% -name %T% &)
command to open the xterm
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-11-2009 11:10 AM
02-11-2009 11:10 AM
Re: auto logout
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-11-2009 11:38 AM
02-11-2009 11:38 AM
SolutionCreate a small scripts and "run_the_application.sh" and put it somewhere.
The contents would be:
# cat run_the_application.sh
#!/usr/bin/sh
cd /home/somestuff
./run_the_application
Be sure to take the lines out of the .profile, and make sure you make run_the_application.sh executable for the appropriate users.
Now modify your xterm line to be:
/usr/bin/X11/xterm -fn 6x13 -sb -ls -display %IP#% -name %T% -e /path/to/run_the_application.sh &)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-11-2009 12:34 PM
02-11-2009 12:34 PM
Re: auto logout
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-30-2009 12:24 PM
04-30-2009 12:24 PM
Re: auto logout
usr/bin/X11/xterm -fn 6x13 -sb -ls -display %IP#% -name %T% -e /path/to/run_the_application.sh &)
My unix auditor doesn't like to see startup program as /usr/bin/csh in the /etc/passwd file as these users are not allowed to open a shell and do anyting. They are just allowed to run the application using x windows directly.
But if I put the startup program as /usr/bin/false instead of /usr/bin/csh for these user, the above command doesn't open the desired application.
What to do?
Thanks again!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-30-2009 06:17 PM
04-30-2009 06:17 PM
Re: auto logout
#!/usr/bin/sh
export DISPLAY+$(who -muR | awk '{print $NF}'):0.0
/full/pth/to/your/Xprogram some-params
exit
Save it and use chmod 755 yourScript. Run it interactively to make sure it works. Note that if any other variables are required for this program to run, be sure to include them in this script.
Bill Hassell, sysadmin
- Tags:
- scummy C shell
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-30-2009 09:04 PM
04-30-2009 09:04 PM
Re: auto logout
Slight typo: export DISPLAY=$(who -muR ...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-13-2009 11:44 AM
05-13-2009 11:44 AM
Re: auto logout
#!/usr/bin/sh
export DISPLAY=$(who -muR | awk '{print $NF}'):0.0
/full/pth/to/your/Xprogram some-params
exit
Thanks for any help on this
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-13-2009 07:30 PM
05-13-2009 07:30 PM
Re: auto logout
#!/usr/bin/sh
export DISPLAY=$(who -muR | awk '{print $NF}'):0.0
/full/pth/to/your/Xprogram some-params
exit
Try something is known to work:
#!/usr/bin/sh
export DISPLAY=$(who -muR | awk '{print $NF}'):0.0
/usr/bin/X11/xclock
exit
This should bring up the Xwindows clock. Your application should follow the $DISPLAY variable but if it does not, set the display according to their documentation.
Bill Hassell, sysadmin
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-14-2009 09:34 AM
05-14-2009 09:34 AM
Re: auto logout
Display is not an issue. User can open the xterm session directly.
Application or Xclock only works when I write /usr/bin/ksh.But once I close the clock or application $ prompt open. It defeats the purpose. I don't want to give user ability to get the $ prompt.
#!/usr/bin/ksh
#export DISPLAY=$(who -muR | awk '{print $NF}'):0.0
/usr/bin/X11/xclock
/usr/bin/ksh
exit
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-14-2009 10:07 AM
05-14-2009 10:07 AM
Re: auto logout
Instead of going into this much trouble, closing the shell after the user finishes using the application, let them drop to a restrictive shell where the only command they can run, is the /path/to/run_the_application
the details of how to set this up can be found under
man sh-posix
look under "rsh Restrictions" heading.
Just a suggestion.
UNIX because I majored in cryptology...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-14-2009 03:31 PM
05-14-2009 03:31 PM
Re: auto logout
> #export DISPLAY=$(who -muR | awk '{print $NF}'):0.0
> /usr/bin/X11/xclock
> /usr/bin/ksh
> exit
I'm not sure what you are doing. You need to create a simple file with 4 lines in it like this:
#!/usr/bin/ksh
export DISPLAY=$(who -muR | awk '{print $NF}'):0.0
/your/program
exit
Don't add any other lines. Save this file in a common location such as /usr/local/bin/myprog and set the permissions to 755 with:
chmod 755 /usr/local/bin/myprog
Now, login using telnet or ssh, then type this command and logout:
chsh $LOGNAME /usr/local/bin/myprog
exit
Now login again and your program should start. Close the program and the telnet or ssh window will also close. NOTE: If your program requires environment values, be sure to put them into this little script.
Bill Hassell, sysadmin
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-14-2009 11:08 PM
05-14-2009 11:08 PM
Re: auto logout
>>
#!/usr/bin/ksh
export DISPLAY=$(who -muR | awk '{print $NF}'):0.0
/your/program
exit
>>
just about to add somethings to your code; for some reasons ,sometimes unable to get hostname (in some custoemr servers) ,so the following needs:
#!/bin/sh
export DISPLAY=`hostname`:`who -muR | awk '{print $NF}' | cut -d ':' -f 2`
echo $DISPLAY
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-15-2009 09:58 AM
05-15-2009 09:58 AM
Re: auto logout
The script itself working fine if you logon to a shell and execute it. There is nothing wrong in the DISPLAY variable or any permission. All I wanted to do is that calling that script directly as a user startup program (instead of shell like /usr/bin/ksh) so that user wonl't get the shell prompt at all. If I call the script as startup program ( which is visible in /etc/passwd) for a user , its not working at all.
#!/usr/bin/ksh
export DISPLAY=$(who -muR | awk '{print $NF}'):0.0
/your/program
exit
Thanks for all your help on this!