05-06-2010
Script, child kills parent
Hello everyone,
I'm trying to write a script, i would like to say the child kills the parent,
how would i do that?
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
I have the following two Korn shell scripts:
SHELL1.ksh
#!/usr/bin/ksh
nohup sas /abc/123/sasprogram1.sas &
SHELL2.ksh
#!/usr/bin/ksh
./SHELL1.ksh
wait
nohup sas /abc/123/sasprogram2.sas &
My goal is to run SHELL1.ksh within SHELL2.ksh. SHELL1.ksh runs sasprogram1.sas. I would like... (1 Reply)
Discussion started by: sasaliasim
1 Replies
2. Shell Programming and Scripting
Hi
I have written a script using ftp to get files from one server and copy them to 2 dirrerent servers. I wish to call this script from a parent script that will check the number of files copied and run a check sum for each file. As the filenames for the files in the get portion of the script... (3 Replies)
Discussion started by: Andy82
3 Replies
3. Shell Programming and Scripting
I have two shell scripts : A.sh and B.sh
A.sh
echo "In A"
exec B.sh
echo "After B"
B.sh
echo "In B"
The output is : In A
In B
I want the output : In A
In B
After B (4 Replies)
Discussion started by: suchismitasuchi
4 Replies
4. Shell Programming and Scripting
Hi everyone
i am very new to linux , working on bash shell.
I am trying to solve the given problem
1. Create a process and then create children using fork
2. Check the Status of the application for successful running.
3. Kill all the process(threads) except parent and first child... (2 Replies)
Discussion started by: vizz_k
2 Replies
5. Shell Programming and Scripting
Hi All,
I have a parent shell script A and a child shell script B.
1). If a command i.e a mysqdump fails in shell script B fails then I trap the error with this code
if ]
then func_exit "Failed to export the cleaned DB1.${MYDBNAME} database to the ${MYARCHIVEDIR} directory"... (1 Reply)
Discussion started by: daveu7
1 Replies
6. Shell Programming and Scripting
I'm likely going to explain this clumsily, so apologies in advance:
I have the following script:
#!/bin/bash
pidPrefix="logGen"
checkPrime ()
{
if /sbin/ifconfig eth0:0|/bin/grep -wq inet;then isPrime=1;else isPrime=0;fi
}
killScript ()
{
/usr/bin/find /var/run -name... (4 Replies)
Discussion started by: DeCoTwc
4 Replies
7. Shell Programming and Scripting
I am having a parent scripts which reads a file with child scripts name.
I need to read one by one child script , execute it and
1. If child script fails send mail to the team with the log file
2. If the child script executes fine then proceed with the next child script execution.
#!... (3 Replies)
Discussion started by: nw2unx123
3 Replies
8. Shell Programming and Scripting
#!/usr/local/bin/bash
set -vx
/prod/HotelierLinks/palaceLink/bin/PalacefilesWait /prod/HotelierLinks/palaceLink/bin/prodEnvSetup 03212013 &
if
then
echo "fatal error: Palace/HardRock failed!!!!" 1>&2
echo "Palace Failed" | mail -s "Link Failed at Palace/HardRock" -c... (1 Reply)
Discussion started by: aroragaurav.84
1 Replies
9. Shell Programming and Scripting
hi,
i want to call a child shell script from a parent shell script. the child will be running for 5 mins. normally when the child is running, parent will wait till the child completes. so in the above case parent will be paused for 5 mins. is there a way so that the parents does not wait for the... (3 Replies)
Discussion started by: Little
3 Replies
10. Shell Programming and Scripting
I have requirement where I need to fail parent if any one of the child process fails. Here is the code snippet
for i in 1 2 3 4 5 6 7 8 9 10
do
child_script $i &
done
wait
I need to fail my main script if any one of my child process fails (8 Replies)
Discussion started by: gvkumar25
8 Replies
FORK(2) BSD System Calls Manual FORK(2)
NAME
fork -- create a new process
SYNOPSIS
#include <unistd.h>
pid_t
fork(void);
DESCRIPTION
Fork() causes creation of a new process. The new process (child process) is an exact copy of the calling process (parent process) except for
the following:
o The child process has a unique process ID.
o The child process has a different parent process ID (i.e., the process ID of the parent process).
o The child process has its own copy of the parent's descriptors. These descriptors reference the same underlying objects, so that,
for instance, file pointers in file objects are shared between the child and the parent, so that an lseek(2) on a descriptor in the
child process can affect a subsequent read or write by the parent. This descriptor copying is also used by the shell to establish
standard input and output for newly created processes as well as to set up pipes.
o The child processes resource utilizations are set to 0; see setrlimit(2).
RETURN VALUES
Upon successful completion, fork() returns a value of 0 to the child process and returns the process ID of the child process to the parent
process. Otherwise, a value of -1 is returned to the parent process, no child process is created, and the global variable errno is set to
indicate the error.
ERRORS
Fork() will fail and no child process will be created if:
[EAGAIN] The system-imposed limit on the total number of processes under execution would be exceeded. This limit is configuration-
dependent.
[EAGAIN] The system-imposed limit MAXUPRC (<sys/param.h>) on the total number of processes under execution by a single user would
be exceeded.
[ENOMEM] There is insufficient swap space for the new process.
LEGACY SYNOPSIS
#include <sys/types.h>
#include <unistd.h>
The include file <sys/types.h> is necessary.
SEE ALSO
execve(2), sigaction(2), wait(2), compat(5)
HISTORY
A fork() function call appeared in Version 6 AT&T UNIX.
CAVEATS
There are limits to what you can do in the child process. To be totally safe you should restrict yourself to only executing async-signal
safe operations until such time as one of the exec functions is called. All APIs, including global data symbols, in any framework or library
should be assumed to be unsafe after a fork() unless explicitly documented to be safe or async-signal safe. If you need to use these frame-
works in the child process, you must exec. In this situation it is reasonable to exec yourself.
4th Berkeley Distribution June 4, 1993 4th Berkeley Distribution