Tracing file installation


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Tracing file installation
# 1  
Old 06-04-2009
Tracing file installation

Hello, my first post here.

I have a script to install a program which runs the user through installation interface offering several options. What I want to do is to trace the possible mistakes during the installation and send them to a logfile. I.e if a user interrupts the installation, I would trap the interrupt. However, I would also like to log the file which was being installed at the moment of pressing ctrl-c.

Also, I'd like to know if there is a way to trap errors like insuficient disk space, trying to write over a read-only file and similar, all with info on the file involved. I was thinking of pre-checking on available disk space, however I'm not sure if quota command is portable on all the systems the program would be installed on.

I understand the question may be too comprehensive for forum posts, so I'd appreciate if you would at least suggest some literature or offer some basic idea if it is possible to implement such logging. Can you think of another errors that could happen during the installation?
# 2  
Old 06-04-2009
i think one part you might be looking for is the unix/linux command "trap" to capture signals like SIGTERM or SIGKILL and do special things after capture this sort of signals.

from the manpage:
Code:
trap [-lp] [arg] [sigspec ...]
    The command arg is to be read and executed when the shell receives signal(s) sigspec. If arg is absent or -, all specified signals are reset to their original values (the values they had upon entrance to the shell). If arg is the null string the signal specified by each sigspec is ignored by the shell and by the commands it invokes. If arg is not present and -p has been supplied, then the trap commands associated with each sigspec are displayed. If no arguments are supplied or if only -p is given, trap prints the list of commands associated with each signal number. Each sigspec is either a signal name defined in <signal.h>, or a signal number. If a sigspec is EXIT (0) the command arg is executed on exit from the shell. If a sigspec is DEBUG, the command arg is executed after every simple command (see SHELL GRAMMAR above). If a sigspec is ERR, the command arg is executed whenever a simple command has a non-zero exit status. The ERR trap is not executed if the failed command is part of an until or while loop, part of an if statement, part of a && or || list, or if the command's return value is being inverted via !. The -l option causes the shell to print a list of signal names and their corresponding numbers. Signals ignored upon entry to the shell cannot be trapped or reset. Trapped signals are reset to their original values in a child process when it is created. The return status is false if any sigspec is invalid; otherwise trap returns true.

hth,
DN2
# 3  
Old 06-04-2009
Thanks DN2, that's exactly what I intended to do. I searched the forum for similar issues before opening this topic and I did find some interesting comments regarding the trap command. This one is helpful, this one as well.

I know how to trap interrupts created by user by pressing ctrl-c (second link is useful), however I'm not sure which signals are created for other possible reasons of termination. Also, I don't have an exact idea how to find out which file was processed at the moment of termination. Is there a way to push filenames to stack/logfile as they are being copied, so I can know that the last file in the list was properly copied, while the next was cancelled? Would you suggest another way of diagnostics?

I was looking into truss command, but I'm afraid of this NOTE: Trussing a process throttles that process to your display speed. I don't want my monitoring to slow down the installation significantly.
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Tracing a function call

Hi I am hoping someone can explain this to me as I am struggling to understand it. I had a problem today with needing to trace a ksh script that was dotting in a function that was writing to stdout. The problem was it was being run in a sub shell and the output was being parsed by the... (1 Reply)
Discussion started by: steadyonabix
1 Replies

2. UNIX for Dummies Questions & Answers

File access tracing

Hello.. Is there anyway to check if some processes are reading one file? Id use inotify, but my kernel is 2.6.9, so it doesnt work. -k- (2 Replies)
Discussion started by: Kimmo_
2 Replies

3. Programming

tracing function with Graphviz

I was searching for a tool to trace the function flow to help me understand the code. I came across the article "visualize function calls with graphviz" by Tim Jones. Visualize function calls with Graphviz I was able to obtain the flow diagram for simple programs and also for the example... (0 Replies)
Discussion started by: cjjoy
0 Replies

4. UNIX for Dummies Questions & Answers

Script for tracing row in a file

Hi! Sorry for stupid questions, I'm quite unfamiliar win *nix systems I have a script which generates the file which looks like that: 12.11.2008 06.01 0 0 0 2 2 0 0 0 12.11.2008 06.02 0 0 0 0 0 0 0 0... (3 Replies)
Discussion started by: consta.v
3 Replies

5. UNIX for Advanced & Expert Users

tracing a user input

Hi, i need to get a log of all the commands typed and output of those commands fired by a specific user on my sun machine. Also i need to trace all commands and inputs given from a specific IP on my machine. Regards Rochit (1 Reply)
Discussion started by: rochitsharma
1 Replies

6. Shell Programming and Scripting

tracing in linux

hello every one can any one help me out i just want to trace what ever i am doing in linux 8.0 in the text mode to be saved in a text file so that at the end i can see my work what i have do. its just like oracle spool so you can see your work at the end . for example what ever command u gave... (2 Replies)
Discussion started by: shary
2 Replies

7. Linux

tracing

hello every one can any one help me out i just want to trace what ever i am doing in linux 8.0 in the text mode to be saved in a text file so that at the end i can see my work what i have do. its just like oracle spool so you can see your work at the end . for example what ever command u gave... (1 Reply)
Discussion started by: shary
1 Replies

8. Shell Programming and Scripting

tracing ethereal traces

Hi All........ i need a perl script that can trace the traces of the ethereal tool. PLZ help me out...............!!!!!!!!! (1 Reply)
Discussion started by: trupti_rinku
1 Replies

9. UNIX for Advanced & Expert Users

Tracing file modifications

Hello all! Is there a way or a utility to trace any kind of file changes in a particular directory on any UNIX machine? The purpose is that in Unix, there are multiple ways of opening and making changes to a file. But internally, there must be something common (a single pipe, etc.) that is... (3 Replies)
Discussion started by: gupta_ca
3 Replies

10. UNIX for Advanced & Expert Users

Tracing a terminal

Hi you all, any of you know how to monitor what is going on in another terminal? I mean if somebody will install an application on my server remotely and I want to "watch" what he is doing. I remember that some one use the "audit" command but now I just can't remember. thanx.:mad: (2 Replies)
Discussion started by: alex blanco
2 Replies
Login or Register to Ask a Question