Sponsored Content
Operating Systems Linux What happens when user logout? Post 302195795 by jim mcnamara on Friday 16th of May 2008 02:20:59 AM
Old 05-16-2008
if you source a shell script that has the exit keyword in it, your process ends and you have to login again. No regular user command, like ls, awk, etc. will do that.

Code:
# sourcing a script note the leading dot
. myscript
# sourcing a script on linux - you can do this as well as the dot notation
source myscript
# this will not log you out
myscript

The only other command that can remove your process is
Code:
kill $$

and some oither variations of kill. Any script with the kill $$ command in it will end when the kill command is executed. Then you have to login again.
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Canīt logout to user inactive

I have SCO OpenServer release 5 I used TIMEOUT and TMOUT in .profile but I donīt Know if is correctly WND=/usr/synergy/dbl DTKMAPFIL=/u/ics/icsdat/icsmap.ics umask 000 ... (1 Reply)
Discussion started by: lalox
1 Replies

2. UNIX for Dummies Questions & Answers

logout

Every time the ksh script completes I got message - logout. I don't want to see this message.... Can someone give me a clue Thanks in advance. ZAM SunOS 5.9 Generic_118558-19 sun4u sparc SUNW,Sun-Fire-880 (2 Replies)
Discussion started by: zam
2 Replies

3. HP-UX

setup a logfile for user login/logout ???

Hi everybody, im a newer, i want to setup a logfile to capture information about user login/logout (and some other events ex: a user ftp, run a speacial command) on my system in HP-UX, pls help me. i think only edit file /etc/syslog.conf but dont know how to do it. Help me. (0 Replies)
Discussion started by: pwd
0 Replies

4. UNIX for Dummies Questions & Answers

setup a logfile for user login/logout ???

Hi everybody, im a newer, i want to setup a logfile to capture information about user login/logout (and some other events ex: a user ftp, run a speacial command) on my system in HP-UX, pls help me. i think only edit file /etc/syslog.conf but i dont know how to do it. Help me. (3 Replies)
Discussion started by: pwd
3 Replies

5. Shell Programming and Scripting

run a script on logout by a non-root user

hi , i need to run a script that delete files when i logout as a user other than root user . I have tried out using .bash_logout but that doesnt seem to work , so any alternative for this to be done. Thanks in advance, Harsha (6 Replies)
Discussion started by: harsha10
6 Replies

6. UNIX for Dummies Questions & Answers

trap signal on user logout ?

hi all , I want to execute a script on the user logout(using gnome environment). Is ther any way to execute it through TRAP stmt? (2 Replies)
Discussion started by: harsha10
2 Replies

7. HP-UX

How to logout

Hi I am using UNIX version. HP-UX HP-UNIX B.11.00 I am writing a script which on certain condition should logout of unix. But with exit command i am not able to get this.. Plz suggest how i should logout of the session directly. (9 Replies)
Discussion started by: manish.s
9 Replies

8. AIX

AIX Syslog login/logout User

Hi, i'm trying to configure /etc/syslog.conf for log user access. In debian i add: auth,authpriv.* @serverName I don't know the correct Aix syntax for syslog :( My @serverName get the log successfully.. I need to log correct/incorrect login attempts. Thanks (5 Replies)
Discussion started by: hankBuck
5 Replies

9. UNIX for Dummies Questions & Answers

Capturing the login logout details of user

Hi I'm new to Shell scripting .Can anyone please help me how to capture user's login and logout details and load them into a table... we are using Oracle DB on UNIX:confused: (3 Replies)
Discussion started by: rajmohan146
3 Replies

10. Shell Programming and Scripting

How can i TRAP a user Logout action?

When the temp user logs in i see his session as below. # who root pts/0 2017-08-18 08:32 (121.87.51.113) temp pts/1 2017-08-18 09:06 (121.87.51.113) root pts/2 2017-08-18 08:59 (121.87.51.113) When he logs out by either firing exit command or closing the... (3 Replies)
Discussion started by: mohtashims
3 Replies
UTMP(5) 							File Formats Manual							   UTMP(5)

NAME
utmp, wtmp - logged in users, login and logout history SYNOPSIS
#include <sys/types.h> #include <utmp.h> DESCRIPTION
The files /etc/utmp and /usr/adm/wtmp respectively contain the currently logged in users, and the history of logins and logouts. Each file is an array of the following structure defined in <utmp.h>: struct utmp { char ut_user[8]; /* user name */ char ut_line[12]; /* terminal name */ char ut_host[16]; /* host name, when remote */ time_t ut_time; /* login/logout time */ }; #define ut_name ut_user/* for compatibility with other systems */ The structure contains more fields than those listed, but they are only of interest to init and login. Note that the ut_name field is a compatibility alias for ut_user, it is actually better to use it. A login entry is completely specified. A logout entry has a null string for ut_name. A shutdown or reboot entry has an ut_line field con- taining a "~" (tilde). The ut_name field is usually the name of the program that did the shutdown, or "reboot" at reboot. This is a bit confusing, but note that there should always be two such entries. If you see just one entry then the system has crashed, if you see two entries then the system was properly shut down and later rebooted. FILES
/etc/utmp Currently logged in users. /usr/adm/wtmp History of logins and logouts. SEE ALSO
who(1), ttyslot(3). AUTHOR
Kees J. Bot (kjb@cs.vu.nl) UTMP(5)
All times are GMT -4. The time now is 09:59 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy