07-27-2009
Signals ignored upon entry to the shell cannot be trapped or reset. Trapped signals are reset to their origi-nal values in a child process when it is created.
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
I'm using the trap command to capture any signals received whilst my script is running.
How's the best way of writing the signal and any other error messages to a file/error log' without having to type '2>$1' on the command line after the script name?
Cheers (3 Replies)
Discussion started by: dbrundrett
3 Replies
2. UNIX for Dummies Questions & Answers
Hi,
I have noticed that rm -if will perform completely different to rm -fi. Whats the pattern of how I put my options to the script in relation to how it will act.
i.e
rm -fi treat the remove as interative but
rm -if treats it as forced
Thansk, Chris. (1 Reply)
Discussion started by: Chiefos
1 Replies
3. Solaris
Hi all,
I work in Sun Solaris 9. I am plan to put the following script(remove90dysOldrfiles.sh) in CRONTAB for removing huge huge number of files those are older than 90 days from different directory.
In the Crontab i will set the time for everymidnight it will search 90days older file and... (2 Replies)
Discussion started by: thepurple
2 Replies
4. UNIX for Advanced & Expert Users
Right now I have implemented autossh between ServerA & ServerB which are sun solaris based. I have made this shell script. I am facing one problem which I am going to discuss now.
The problem is when I sftp some files (suppose there is 10 files I have to transfer through sftp) from one server
to... (2 Replies)
Discussion started by: girish.batra
2 Replies
5. Shell Programming and Scripting
Hi folks,
I have tried to add some trap detection in the below script....this script is used to monitor database activities...in a rather awkward way :rolleyes:....
The idea behind adding trap is that....this script creates lots of temporary files in the running folder to store the count... (1 Reply)
Discussion started by: frozensmilz
1 Replies
6. Virtualization and Cloud Computing
2008-10-31T22:46:14+01:00
http://geekandpoke.typepad.com/.a/6a00d8341d3df553ef010535ce543e970c-800wi
Nicholas Carr (and here) has some problems with Tim O'Reilly's theory about the cloud and the network effect.
http://feeds.feedburner.com/~f/GeekAndPoke?i=OFn0M... (0 Replies)
Discussion started by: Linux Bot
0 Replies
7. Shell Programming and Scripting
cmd='date | wc' or cmd="date | wc"
$cmdIf this script is executed, an error is generated. The reason written was that "The execution fails because the pipe is not expanded and is passed to date as an argument". What is meant by expansion of pipe. When we execute date | wc on the command line, it... (2 Replies)
Discussion started by: daudiam
2 Replies
8. UNIX for Advanced & Expert Users
Hello experts!
I need to know the use of trap command please
In one of our program we have trap "rm -f temp1 ; exit 1" 1 2 15 0
and program always exit with 1
there is a rm -f temp1 as well at the end of the program
as
rm -f temp1
exit 0
when I test a probram with set... (4 Replies)
Discussion started by: ramshree01
4 Replies
9. Shell Programming and Scripting
It doesn't have effect in script but it works on the terminal
root@server:/opt/kvm/usecases/logs# alias echo='echo -e'
root@server:/opt/kvm/usecases/logs# echo "xxxx\n"
xxxx
root@server:/opt/kvm/usecases/logs# cat xx.sh
#!/bin/bash
alias echo='echo -n'
echo "sssf \n"
... (3 Replies)
Discussion started by: yanglei_fage
3 Replies
10. Shell Programming and Scripting
Hi,
I am writing the script for tomcat logs clean up ending with *.txt and *.log.
cleanup should be applied to logs older than 7 days logs same will be scheduled in cron.
after googling found below but it only help partially.
find . -type f -name '*.log' -exec truncate --size 0 "{}" \;
I... (6 Replies)
Discussion started by: Riverstone
6 Replies
LEARN ABOUT NETBSD
signal
SIGNAL(3) BSD Library Functions Manual SIGNAL(3)
NAME
signal -- simplified software signal facilities
LIBRARY
Standard C Library (libc, -lc)
SYNOPSIS
#include <signal.h>
void (*
signal(int sig, void (*func)(int)))(int);
DESCRIPTION
This signal() facility is a simplified interface to the more general sigaction(2) facility.
Signals allow the manipulation of a process from outside its domain as well as allowing the process to manipulate itself or copies of itself
(children). There are two general types of signals: those that cause termination of a process and those that do not. Signals which cause
termination of a program might result from an irrecoverable error or might be the result of a user at a terminal typing the `interrupt' char-
acter. Signals are used when a process is stopped because it wishes to access its control terminal while in the background (see tty(4)).
Signals are optionally generated when a process resumes after being stopped, when the status of child processes changes, or when input is
ready at the control terminal. Most signals result in the termination of the process receiving them if no action is taken; some signals
instead cause the process receiving them to be stopped, or are simply discarded if the process has not requested otherwise. Except for the
SIGKILL and SIGSTOP signals, the signal() function allows for a signal to be caught, to be ignored, or to generate an interrupt. See
signal(7) for comprehensive list of supported signals.
The func procedure allows a user to choose the action upon receipt of a signal. To set the default action of the signal to occur as listed
above, func should be SIG_DFL. A SIG_DFL resets the default action. To ignore the signal func should be SIG_IGN. This will cause subse-
quent instances of the signal to be ignored and pending instances to be discarded. If SIG_IGN is not used, further occurrences of the signal
are automatically blocked and func is called.
The handled signal is unblocked when the function returns and the process continues from where it left off when the signal occurred. Unlike
previous signal facilities, the handler func() remains installed after a signal has been delivered.
For some system calls, if a signal is caught while the call is executing and the call is prematurely terminated, the call is automatically
restarted. (The handler is installed using the SA_RESTART flag with sigaction(2)). The affected system calls include read(2), write(2),
sendto(2), recvfrom(2), sendmsg(2) and recvmsg(2) on a communications channel or a low speed device and during a ioctl(2) or wait(2). How-
ever, calls that have already committed are not restarted, but instead return a partial success (for example, a short read count).
When a process which has installed signal handlers forks, the child process inherits the signals. All caught signals may be reset to their
default action by a call to the execve(2) function; ignored signals remain ignored.
Only functions that are async-signal-safe can safely be used in signal handlers, see signal(7) for a complete list.
RETURN VALUES
The previous action is returned on a successful call. Otherwise, SIG_ERR is returned and the global variable errno is set to indicate the
error.
ERRORS
signal() will fail and no action will take place if one of the following occur:
[EINVAL] Specified sig is not a valid signal number.
[EINVAL] An attempt is made to ignore or supply a handler for SIGKILL or SIGSTOP.
SEE ALSO
kill(1), kill(2), ptrace(2), sigaction(2), sigaltstack(2), sigprocmask(2), sigsuspend(2), psignal(3), setjmp(3), strsignal(3), tty(4),
signal(7)
HISTORY
This signal() facility appeared in 4.0BSD.
BSD
June 11, 2004 BSD