Sponsored Content
Top Forums Shell Programming and Scripting Stop child script by stoping parent script Post 302575314 by geovas on Monday 21st of November 2011 09:26:25 AM
Old 11-21-2011
Stop child script by stoping parent script

Hi everyone,

I have this problem with a script I'm writting. I want to execute a code running in the background several times through a script. I am writting it like that
parent_script
Code:
for a in 1 2 3 4 5 
do 
exec test -n $a
done

What I want to do is when parent_script is killed, all instances of test script to be killed as well. Does anyone have any ideas for that?

Thanks in advance
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

return valuse from child script to parent script

Hi, I am trying to return a value from child script to a parent script just as a function does. The child script will look for a file and if exists will return 1 else 0. I need to capture the status 1 from child script in the parent script and proceed further. if 0, i need not do... (1 Reply)
Discussion started by: borncrazy
1 Replies

2. Shell Programming and Scripting

Parent/child Korn shell script help

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

3. Shell Programming and Scripting

Passing a variable from a child script back to the parent

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

4. Shell Programming and Scripting

How to return control from the child script to the parent one?

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

5. Shell Programming and Scripting

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? (2 Replies)
Discussion started by: jessy21
2 Replies

6. Shell Programming and Scripting

Parent Script exiting with child script

PARENT SCRIPT #!/bin/ksh # . $HOME/.profile . /etl/estdm2/DEV/scripts/DM_ENV_VARS.ksh DEV DB echo "CALLING CHILD SCRIPT" . /${SCRIPT_DIR}/DM_CHild.ksh -x HRDATA.dat -e $sEnv -d Wait_Time *****THE PARENT SCRIPT EXITS HERE ******** *****whether the file is found or not******* ... (2 Replies)
Discussion started by: sumeet
2 Replies

7. Shell Programming and Scripting

Child exiting and not returning to parent script

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

How to capture exit code of child script and send it to parent script?

#!/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

How to exit from the parent script while the child is running?

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

Fail Parent Script if any of the child fails

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
IVMAN-LAUNCH(8) 					      System Manager's Manual						   IVMAN-LAUNCH(8)

NAME
ivman-launch - launch script for Ivman SYNOPSIS
ivman-launch [ --exit-with-session <cmd> ] [ OPTIONS ] [ COMMAND [ ARGS... ]] DESCRIPTION
ivman-launch is a simple script used to launch Ivman. Its sole purpose is to ensure Ivman is closed at the end of a user's login session. You can use it if your session manager does not properly close Ivman when you log out. ivman-launch supports the same command-line options as Ivman, and one additional option: --exit-with-session. Thus, there is no point using ivman-launch if you do not need to use this option. If you supply a COMMAND (with optional ARGS), the the specified command will be run after ivman is started, and ivman will be killed after that command exits. OPTIONS
--exit-with-session <cmd> ivman-launch will block until the command 'cmd' terminates, at which point it will kill Ivman and exit itself. If the command 'cmd' is not running when ivman-launch is started, Ivman will exit immediately. Note that this option implies Ivman will be called with the '--nofork' option. option. --debug --nofork --system These flags be passed to the launched ivman command. EXAMPLES
ivman-launch --exit-with-session xinit & The ivman process will be started, then the xinit process is watched. When the xinit process exits, ivman is killed. Placing this command in an ~/.xinitrc file would cause Ivman to launch in the background when your session begins, and exit when your session ends: ivman-launch /usr/bin/x-window-manager The ivman process is launched, then /usr/bin/x-window-manager is run, when x-window-manager exits, ivman is killed. This is an example of how ivman might be launched from Xsession in order to chain several programs together in one session. SEE ALSO
ivman(8) Xsession(5) CREDITS
This script was written by Daniele Favara. 10 February 2006 IVMAN-LAUNCH(8)
All times are GMT -4. The time now is 09:29 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy