how to run a command as soon as user exits from session


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting how to run a command as soon as user exits from session
# 1  
Old 07-28-2011
how to run a command as soon as user exits from session

I need to write a script, where I have to get names of files that are to be deleted from a user and have to delete those files when he exits session.

How to set a particular command to be run as soon as user exits from a session?

Can somebody help?

I have to write a script on linux system. There is no desktop environment on the system and users log in through SSH.

Last edited by yashashri; 07-29-2011 at 02:30 AM.. Reason: Incomplete info
# 2  
Old 07-28-2011
It depends on many factors (your system, what session - console or desktop environment or ssh or something else, shell, how a user enters a session and what do you really want - to control a user or for yourself, etc.).

I believe your question has no information for an answer.
# 3  
Old 07-28-2011
I first time come here, are you want to execute a command when you logout system ? if i say it's right , you can write some command in the logout script under in the root !
# 4  
Old 07-28-2011
Sorry for incomplete information.

I have to write a script on linux system. There is no desktop environment on the system and users log in through SSH.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

Run compile command make as another user

Hello I'm trying to compile LibreOffice core from github.com. But this can - as far as I know - not be done as root user. So I compiled it as login user (the user as I log in) and compilation works. Now I try to compile LibreOffice core as a user I created using useradd: useradd -r -U -m... (2 Replies)
Discussion started by: go4bash
2 Replies

2. Shell Programming and Scripting

Execute a command after ssh exits

In my .tcshrc I define and run an alias to set my terminal title. The title contains the hostname. I do this because I ssh to other machines a lot and I always need to know which host I am typing in. The alias is defined and run in the .tcshrc like this... alias tt 'echo -n "^0;`hostname -s`^G"'... (5 Replies)
Discussion started by: salvadorjoshua
5 Replies

3. Shell Programming and Scripting

Check when user exits SUDO

Hello to everyone, I'm new here and would like to thank everybody for the upcoming support, I know that I will have my question answered here, this community is huge. :) First of all, I´m a DBA and work on a daily basis on Unix environments of all kinds (HP-UX, Solaris, AIX, etc). I have... (8 Replies)
Discussion started by: ZeroBR
8 Replies

4. Shell Programming and Scripting

tuxedo command run from another user

Hi , I would like to know, whether if it is possible or not. I am runing one tuxedo command script. This script should run on another userID and stored the data on another UserID. For Example: UserA : The Script is available in this userID location. . If i run that script then it... (3 Replies)
Discussion started by: Mani_apr08
3 Replies

5. Shell Programming and Scripting

'script' command exits immediately

I'm trying to capture the output of some commands with the 'script' utility. Normally, I would type 'script /path/to/output/file', then enter commands, then hit ctrl+D to end the 'script' capture. I'm having trouble with it on a server. Upon starting 'script', it exits immediately before I type... (6 Replies)
Discussion started by: jalburger
6 Replies

6. UNIX for Advanced & Expert Users

How can I run command with super user privledge

Hello All, I am working on UNIX like environment. This environment is ported from UNIX. Here when we need to build product set, we need to run some script with super user privledge (which we normal user dont have) Is there any way (some C program or some script) through which any normal... (2 Replies)
Discussion started by: joshi123
2 Replies

7. Shell Programming and Scripting

Save the output of the command run as other user

Dear All, I am writing a script and kind of stuck in a small thing. Cannot figure it out. so please help I am logged in as root user. I want to switch user to "user1" inside the script and execute a specific command lets say "pwd" and come back where i started. I know how to switch user,... (16 Replies)
Discussion started by: suhail.sadaqat
16 Replies

8. AIX

run which command to check the actual user

hi gurus, i have a question: when run which javac under a user account I got the following results: PROD DB Server: /usr/java14/bin/javac DR DB Server: /usr/java14/bin/javac DEV DB Server: /usr/java5_64/bin/javac The .profile in all environments are same. so how do know who is the... (1 Reply)
Discussion started by: lweegp
1 Replies

9. Shell Programming and Scripting

Script exits with $? not 0 randomly, how can I see what command failed?

Hi! I have this situation with 3 shellscripts. One is a "startscript" that simply calls other scripts. This one is scheduled with cron to run at regular intervals. That script runs what I'll refer to as Script 1. Script 1 in turn runs script 2 (import_catalogs_buyer.sh) Sometimes, seemingly... (2 Replies)
Discussion started by: trailsmoke
2 Replies

10. Shell Programming and Scripting

How to run a command with some other user id

Hi Say I am running a script using my user id csaha. How can I run any specific command in the same sctipr using any other user id (say root). Definitely I have the password of root. Any idea how the same can be achieved ??? Example: I need to run a script using my id (csaha) only on... (4 Replies)
Discussion started by: csaha
4 Replies
Login or Register to Ask a Question