02-12-2014
Fantastic!
Thank you guys for pointing me in the right direction!
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
AIX 4.3.3
I am trying to write a signal handler into a ksh shell script. I would like to capture the SIGTERM, SIGINT, and the SIGTSTP signals, print out a message to the terminal, and continue executing the script. I have found a way to block the signals:
#! /bin/ksh
SIGTERM=15
SIGINT=2... (2 Replies)
Discussion started by: jalburger
2 Replies
2. UNIX for Advanced & Expert Users
Hi
can any please tell me
is it possible to catch the signal in a shell script like we do in C.
if yes please give me some idea or a link. (4 Replies)
Discussion started by: Raom
4 Replies
3. Shell Programming and Scripting
Helo,
I want to write shell script which takes back of all binaries (exe files).
and when i uninstall the upgraded system which automatically restore the old binary which we have take as back up.
can u tell me how to write such shell scripts.
Regards,
Amit (5 Replies)
Discussion started by: amitpansuria
5 Replies
4. Shell Programming and Scripting
I need to write a c program that uses the fork and excel system calls to run the shell script mode invoked like this: "./mode 644 ls -l" (that is the argumetns will always be 644 ls -l)
here's the mode script:
#!/bin/sh
octal="$1"
shift
find . -maxdepth 1 -perm $octal -exec $@ {} \;
... (3 Replies)
Discussion started by: computethis
3 Replies
5. Shell Programming and Scripting
Hi ,
I do have a shell which test the connectivity using ssh, soon after the login it should use the keys Ctrl + z or Ctrl + c to exit from login promt. So how do i need to implement these . (3 Replies)
Discussion started by: raghunsi
3 Replies
6. Shell Programming and Scripting
Hi ,
i have a scenario where...i have to put a check where if script is executing more than 15mins i have to kill that script and n retry again 2nd time.
i this case i can use background process to do it but i feel trap will be the efficent way to do so...
but i dont know much about it... (1 Reply)
Discussion started by: crackthehit007
1 Replies
7. Shell Programming and Scripting
When command is executed by forking, the console displays the status of that command. I want to suppress it.. how to do it ?
Example:
var1=`date` &
echo "hello world";
output:
hello world
+ Done var1=`date`
I want to suppress the second line "+ Done var1=`date`".
I... (10 Replies)
Discussion started by: Arun_Linux
10 Replies
8. Shell Programming and Scripting
Hi, I'm writing a shell script where I want to call fork(). However I wrote like this "var=fork()" in c style and got this error:
"syntax error near unexpected token `(' "
How could I call fork() in shell script? Thanks in advance.
Duplicate Post - Continue Here - Please Do Not Cross Post... (0 Replies)
Discussion started by: Xiaoya
0 Replies
9. Ubuntu
Hi, I'm writing a shell script where I want to call fork(). However I wrote like this "var=fork()" in c style and got this error:
"syntax error near unexpected token `(' "
How could I call fork() in shell script? Thanks in advance. (2 Replies)
Discussion started by: Xiaoya
2 Replies
10. Shell Programming and Scripting
Hi All,
I have a shell script(test_abc.sh) with the following shell commands, which are invoking the same shell script with different parameters.
test_abc.sh
. ./test.sh abc >> test.log
. ./test.sh xyz >> test.log
. ./test.sh pys >> test.log
. ./test.sh abc >> test.log
.
.
... (4 Replies)
Discussion started by: dev.devil.1983
4 Replies
LEARN ABOUT OPENDARWIN
pthread_atfork
PTHREAD_ATFORK(3) Library Functions Manual PTHREAD_ATFORK(3)
NAME
pthread_atfork - register handlers to be called at fork(2) time
SYNOPSIS
#include <pthread.h>
int pthread_atfork(void (*prepare)(void), void (*parent)(void), void (*child)(void));
DESCRIPTION
pthread_atfork registers handler functions to be called just before and just after a new process is created with fork(2). The prepare han-
dler will be called from the parent process, just before the new process is created. The parent handler will be called from the parent
process, just before fork(2) returns. The child handler will be called from the child process, just before fork(2) returns.
One or several of the three handlers prepare, parent and child can be given as NULL, meaning that no handler needs to be called at the cor-
responding point.
pthread_atfork can be called several times to install several sets of handlers. At fork(2) time, the prepare handlers are called in LIFO
order (last added with pthread_atfork, first called before fork), while the parent and child handlers are called in FIFO order (first
added, first called).
To understand the purpose of pthread_atfork, recall that fork(2) duplicates the whole memory space, including mutexes in their current
locking state, but only the calling thread: other threads are not running in the child process. The mutexes are not usable after the fork
and must be initialized with pthread_mutex_init in the child process. This is a limitation of the current implementation and might or
might not be present in future versions.
RETURN VALUE
pthread_atfork returns 0 on success and a non-zero error code on error.
ERRORS
ENOMEM insufficient memory available to register the handlers.
AUTHOR
Xavier Leroy <Xavier.Leroy@inria.fr>
SEE ALSO
fork(2), pthread_mutex_lock(3), pthread_mutex_unlock(3).
LinuxThreads PTHREAD_ATFORK(3)