Script commad implementation - urgent help


 
Thread Tools Search this Thread
Top Forums UNIX for Advanced & Expert Users Script commad implementation - urgent help
# 1  
Old 03-13-2009
Script commad implementation - urgent help

I modified the .profile of a user id to start "script" when the user logs in.
When the user logs out, I have added a trap command in the .profile file to capture the exit signal.
And in that trap command, I have added the creation of a file called .logout.
And in the .logout file, I have added the command to send the test_audit file(created by script command) to the management, as an email.

Since the starting of the "script" is in the .profile of the user id what would keep someone from logging on as absprod1 run the ps -ef command find the "script" running in the profile and use the kill command to stop the "script" from running which would stop the tracking or logging of this data.

Also, if the session is closed without running the exit command then the logging is also not saved and emailed out ?

How to achieve the above 2 points? Can someone please guide me.
# 2  
Old 03-16-2009
I would have put and exit as next line (end?) after script, for to log out you would need 2 exit (and like that killing the script exits anyway...), so if I follow you you trap the first one and send the second after you script execution, am I right?
I would not bother to trap but add directly your next command (with the exit...), so if he does kill himself he also get logged of...
needs testing...
# 3  
Old 03-16-2009
Did not get it quite well. Where should I add an exit command? Can you please help?
# 4  
Old 03-17-2009
I just tested: (2 last lines of .profile)
Code:
script in_script.`date '+%m-%d-%E-%H:%M'` 
exit

gives:
Code:
remsh ant
.
.
                           Hewlett-Packard Company
                           3000 Hanover Street
                           Palo Alto, CA 94304 U.S.A.

Rights for non-DOD U.S. Government Departments and Agencies are as set
forth in FAR 52.227-19(c)(1,2).
You have mail.
Script started, file is in_script.03-17-2009-11:22                      
ant:/home/vbe $ exit
Script done, file is in_script.03-17-2009-11:22
logout
Connection closed.
aco:/home/vbe $ 

And again but on ant:
ant:/home/vbe $ ps -ef|grep script
     vbe 26016 10159  0 11:24:06 pts/18    0:00 grep script
     vbe 25988 25962  0 11:23:50 pts/29    0:00 script in_script.03-17-2009-11:23
ant:/home/vbe $ kill 25988
ant:/home/vbe $ 

Result on aco:
remsh ant...
                           3000 Hanover Street
                           Palo Alto, CA 94304 U.S.A.

Rights for non-DOD U.S. Government Departments and Agencies are as set
forth in FAR 52.227-19(c)(1,2).
You have mail.
Script started, file is in_script.03-17-2009-11:23                      
ant:/home/vbe $ Script done due to signal 15, file is in_script.03-17-2009-11:23
logout
Connection closed.
aco:/home/vbe $

Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

URGENT Reading a file and assessing the syntax shell script URGENT

I am trying to write a shell script which takes an input file as an arguement in the terminal e.g. bash shellscriptname.sh input.txt. I would like for the file to be read line by line each time checking if the .txt file contains certain words or letters(validating the syntax). If the line being... (1 Reply)
Discussion started by: Gurdza32
1 Replies

2. Programming

UNIX commad in COBOL

Hi guys, i used the call "sytem" using ... in a cobol program. At the moment i stoped at an empasse, how cam I retrive the execution's result of unix command? Explenation, I made an 'pwd' command, and I must to have the directory inside the program. How can have this result? (2 Replies)
Discussion started by: Prosy60
2 Replies

3. OS X (Apple)

Script Implementation for Disabling Re-Opening Previous Login

Ok guys, I'm just getting back to this amongst several other projects, but I thought I'd re-address it. I'm creating the script to disable windows from the previous login under 10.7. In order to do this it seems I need to create the same script for applications that launch and create the... (6 Replies)
Discussion started by: unimachead
6 Replies

4. UNIX for Dummies Questions & Answers

Need help in excluding a particular directory using Find commad

Hi, I have a directory structure as below /home/gad/Merl/a/a1.txt /home/gad/Merl/b/a1.txt /home/gad/Merl/c/a1.txt How can I find the file a1.txt but not from directory 'a' and it(the filw) should loaded 6 days ago.. Can any one pls help,quick reply much appriciated.. Thanks. (1 Reply)
Discussion started by: jagadish_gaddam
1 Replies

5. Shell Programming and Scripting

(Urgent):Creating flat file using sql script and sqlplus from UNIX Shell Script

Hi, I need help urgently for following issue. Pls help me to resolve this issue. I am calling sql script file(file1.sql) from UNIX Shell Script(script1.ksh) using sql plus and trying to create flat file that contains all records returned from SQL query in SQL script(file1.sql) I given... (6 Replies)
Discussion started by: praka
6 Replies

6. UNIX for Dummies Questions & Answers

help with ls commad

hi I want to display the latest file in script. say for example file.txt1 file.txt2 file.txt3(latest) in the script var1=`ls -ltr file.txt* | tail-1` echo $var1 This is what i am using. But this says that file.txt*: No such file or directory To the same script if I pass... (5 Replies)
Discussion started by: ammu
5 Replies

7. Shell Programming and Scripting

[urgent need help] about script

hi experts, i'm new on scripting on solaris 8 sparc, need some advices. i have some data in a file like : 20061221 163826.485 20061221 163925.144 058.659 6123456789012 00000E8A 047 08 002 465 00010022 510105642138069 20061221 163915.163 20061221 163925.336 010.173 6123456789012 00000F4F... (6 Replies)
Discussion started by: bucci
6 Replies

8. Shell Programming and Scripting

Writing and executing a script in RTR implementation of UNIX

Can anybody provide a complete procedure for writing and executing a script in RTR(real time reliable) implementation of UNIX (0 Replies)
Discussion started by: mahajan.anubhav
0 Replies

9. Shell Programming and Scripting

Need a Script(Urgent)

sdfggggggggggggggggggggg (7 Replies)
Discussion started by: udayben
7 Replies

10. Filesystems, Disks and Memory

Commad to Delete Nested Directory

Can someone please tell me the command to delete a NESTED DIRECTORY. here is my email address: firewalls007@hotmail.com (2 Replies)
Discussion started by: Javed Akram
2 Replies
Login or Register to Ask a Question