Caller Script should produce and email from 4 different script within it


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Caller Script should produce and email from 4 different script within it
# 1  
Old 01-15-2010
Question Caller Script should produce and email from 4 different script within it

Hi

I wrote a shell script , which includes one output file which is emailed back to me , when the script runs .

Now i want to slip the script into 4 different shell scripts each of which taking the parameter PROD or DEV, and include all the 4 different shell scripts in a caller script.

The idea behind doing like this is , if their is problem with one script atleast the other script should not stop from running .

Now my whole idea is still to get only one email when we run the caller script .
So how to direct the output of each script such a way , that we get only one output file and one email from running the caller.

Pls help me , with this .

Also , can the common local variables to all the 4 shell scripts be in the caller script and code where it chooses the parm PROD or DEV ..

is so , how would the 4 scripts take those local variables and use them to run itself .

ANy help is appreciated ..
# 2  
Old 01-15-2010
In sh and bash there's no way to pass parameters from child to parent, neither from subshells to master shell.
The turnaround i use is to write parameters in an appropriate form to a file. The form can be just values of the variables or strings like "var_A=value" which can be treated after reading by 'eval'.
If you don't write to disk, maybe you have a /dev/shm directory which is a world-writeable "ramdisk" which can be useful to store temporary files or parameters.
The problem you can encounter is when two ore more scripts try to write simultaneously to the file, if there's only one.
# 3  
Old 01-15-2010
I am guessing this is what you are looking for
## In your parent script e.g. par.sh
# call chi.sh
. ./chi.sh
echo $var_in_chi

## In you child script e.g. chi.sh
export var_in_chi=100

So now if you run par.sh you will see a 100.
Please note, your parent script should call the child script with a ". "
# 4  
Old 01-16-2010
Error

Quote:
Originally Posted by linuxpenguin
Please note, your parent script should call the child script with a ". "
The ". " doesn't make a call of the script but sources the script. ". script.sh" is an equivalent of "source script.sh". It doesn't launch any new process, it's like an "include" in C.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Bash script won't run because hardware won't produce display

Can anyone offer any advice on how to modify the script below to work on a new system we have, that has no graphics capability? We admin the system through a serial RAS device. I've tried running the below script through the RAS and through an ssh -X session. It failed with something like "GTK... (3 Replies)
Discussion started by: yelirt5
3 Replies

2. Shell Programming and Scripting

Need help fix my script to get alerts when the command produce n expected output

Hi, Below is my script, which is used to invoke a test using curl command. #/usr/bin/sh MAILTO=user@xyz.com URL='https://myserver.xyz.net/test/dir/test123.tws' SOAPFILE=/tmp/soap.txt curl -k -s -S --header 'Content-Type: text/xml;charset=UTF-8' --data @"${SOAPFILE}" "${URL}" ... (3 Replies)
Discussion started by: System Admin 77
3 Replies

3. Shell Programming and Scripting

Passing variable from called script to the caller script

Hi all, Warm regards! I am in a difficult situation here. I have been trying to create a shell script which calls another shell script inside. Here is a simplified version of the same. Calling Script. #!/bin/ksh # want to run as a different process... (6 Replies)
Discussion started by: LoneRanger
6 Replies

4. Shell Programming and Scripting

How to produce a executable Oracle script from bash script?

Hi here's my code ${ORACLE_HOME}/bin/sqlplus /nolog <<!EOF --step 5 create db script start set feedback off set heading off set echo off conn / as sysdba spool ${ORACLE_SID}_db_link.sql SELECT 'CREATE '||DECODE(U.NAME,'PUBLIC','public ')||'DATABASE LINK '||CHR(10)... (2 Replies)
Discussion started by: jediwannabe
2 Replies

5. Shell Programming and Scripting

Help in modifying existing Perl Script to produce report of dupes

Hello, I have a large amount of data with the following structure: Word=Transliterated word I have written a Perl Script (reproduced below) which goes through the full file and identifies all dupes on the right hand side. It creates successfully a new file with two headers: Singletons and Dupes.... (5 Replies)
Discussion started by: gimley
5 Replies

6. Shell Programming and Scripting

Script to produce report of High Utilization Processes

Hi, I have requirement to produce a report on high CPU utilization processes and the processes lying on the CPU for long time (Long running queries). The report should append into the files every 3 minutes. I use prstat to pull top 5 and found the following result. ... (3 Replies)
Discussion started by: thinakarmani
3 Replies

7. Shell Programming and Scripting

Script to send email after comparing the folder permissions to a certain permission & send email

Hello , I am trying to write a unix shell script to compare folder permission to say drwxr-x-wx and then send an email to my id in case the folders don't have the drwxr-x-wx permissions set for them . I have been trying to come up with a script for few days now , pls help me:( (2 Replies)
Discussion started by: nairshar
2 Replies

8. Shell Programming and Scripting

Shell script that will compare two config files and produce 2 outputs 1)actual config file 2)report

Hi I am new to shell scripting. There is a requirement to write a shell script to meet follwing needs.Prompt reply shall be highly appreciated. script that will compare two config files and produce 2 outputs - actual config file and a report indicating changes made. OS :Susi linux ver 10.3. ... (4 Replies)
Discussion started by: muraliinfy04
4 Replies

9. Shell Programming and Scripting

Perl Script to produce a file

hi i got a file called essay which contain few pages with many paragraphs. now i wanna with PERL to produce another file which called Essaylist that contain a sorted list of words that appear in the file essay. the format for Essaylist: $word found $times times on page a b c.... where $word... (3 Replies)
Discussion started by: mingming88
3 Replies

10. Shell Programming and Scripting

finding script name of function caller??

# utils.sh #!/bin/sh myfunc() { echo "hello from myfunc" } #----------------------- begin caller script # now myfunc is called in another script: # and I'd like that myfunc echos the caller script!!! #!/bin/sh source ./utils myfunc #---------------------- end caller script ... (3 Replies)
Discussion started by: andy2000
3 Replies
Login or Register to Ask a Question