Sponsored Content
Top Forums Shell Programming and Scripting Advice needed on using Script with NOHUP Post 302403075 by bharath.gct on Thursday 11th of March 2010 10:28:44 AM
Old 03-11-2010
Advice needed on using Script with NOHUP

All,

I would like to know my below requirement can be achieved in any way in Shell Scripting? I will make this requirement of mine as understandable as I can.

Requirement:
I wrote a script 'my.script' which gets user-input tablenames and puts the same into an array. Also I get other inputs like logon credentials, Source Database name etc.

I process all the inputs to generate a 'fexp.exec' script on the fly. Then I am trying to execute the 'fexp.exec' script from 'my.script', to start the FastExport process (Teradata Utility to unload the source DB tables to the Unix environment as files). And once 'fexp.exec' script (FastExport) completes, the control returns back to the 'my.script' where I am validating the output files (created from the FastExport) based on the entered input files.

This whole effort is to automate the Unloading of tables from DB to Unix. Before writing the 'my.script', I used to prepare the 'fexp.exec' script manually and run it with a NOHUP (something like the code below), so that i can allow it to run in the background (as FastExport runs for 2 hours).

Code:
nohup ksh fexp.exec &

Question:
But now with this effort to automate, I have a requirement to run the 'fexp.exec' script from 'my.script'. And I want the 'fexp.exec' script to be run in the background. Also I do not want to make the my.script run for 2 hours as well!

I know I can just give the above line of code in my 'my.script' file to run the FastExport in the background. But I have the validation of the output files (created from FastExport) based on the entered input files, in 'my.script'. And immediately once after nohup of 'fexp.exec', the validation part in 'my.script' continues and it fails as the output files are not present as the fexp.exec is still running in the background.

To resolve this I see a few ways, but none of them are fruitful. I would need some advise on how to proceed with my condition here!

1. I can put a wait command after the nohup of fexp.exec, but that would make the my.script to wait for 2 hours, which I dont need.

2. I can nohup the my.script file itself but the script accepts user-input in various parts of the script.

3. I tried to echo the validation part into the fexp.exec script after the FastExport commands, so that I can just nohup the 'fexp.exec' and allow the my.script to run to completion once fexp.exec is nohup-ed. For this I have to pass the array that I received in my.script to fexp.exec. But that again is not working. I can post the code for this if you want.

Is there anyother way to achieve my requirement. I am sorry for writing a long story here. Hope I am not confusing anyone. Please let me know if you have any questions. Any help is very greatly appreciated.

p.s: I can post the code for the requirement or the #3 above, if anyone needs it for more understanding. i am not posting the code now just to prevent my post being toooo long Smilie

Thanks
Bharath
 

10 More Discussions You Might Find Interesting

1. Linux

programming advice needed....

i'm a grad student taking a UNIX course and a networks course (i have a background in C++ and JAVA). i'm trying to combine the two classes. My questions stems from a networks programming homework assignment below: "Using the operating system and language of your choice, develop a program to... (5 Replies)
Discussion started by: trostycp
5 Replies

2. Solaris

Using San storage - advice needed

Thinking of using our San for network backups.. Have a Netra 240 being installed and planning to get some space on our San. Do you know what software is used to access the San from my server or what I would need to do? I know how to connect to local storage, disk arrays etc but not sure what... (1 Reply)
Discussion started by: frustrated1
1 Replies

3. Shell Programming and Scripting

eval problem.. advice needed!

Hi I need some major help with eval I have a statement using eval: read input eval variable$input=”something” Now I want to use the “variable$input” in some commands but I don't know how to call it without replacing the $input with the command line value (which I obviously can't do). ... (1 Reply)
Discussion started by: Cactus Jack
1 Replies

4. Linux

GUI builder advice needed ......

Hello all, I need to develop an application that would be used as a simulator to test various custom algorithms. As I have never embarked on this kind of work, I need some advice: 1. Which GUI library to use in Linux, GTK+ or FLTK? The simulator application needs to output various... (2 Replies)
Discussion started by: fox_hound_33
2 Replies

5. Filesystems, Disks and Memory

LVM resizing advice needed

Hi I have a CentOS 5 server with LVM. / and /home are low on disk space. I have ~12Gb available on /usr I plan to resize /usr and add the available space to the other 2 partitions. Please advice me on any precautions I need to take. Any problem if you have faced doing similar stuff and... (0 Replies)
Discussion started by: yunusyb
0 Replies

6. Shell Programming and Scripting

'for' loop advice needed ....!!

/usr/sbin/ifconfig -a | grep "inet" | grep -v "inet6" | grep -v "127.0.0.1" | grep -v "0.0.0.0"|grep -v "192.168.100.2" | awk '{print $2}' I use above command to get IP addresses on AIX boxes.Values coming here are set to a variable "Host IPs.IP Addresses" in my fingerprinting engine. ... (4 Replies)
Discussion started by: ak835
4 Replies

7. UNIX for Advanced & Expert Users

'for' loop advice needed....!!

Scenario: Command used to capture IPs on a host: /usr/sbin/ifconfig -a | grep "inet" | egrep -v "inet6|0.0.0.0|192.168.100.2" | awk '{print $2}' Following for loop used to capture interface names: for INTERFACE in `/usr/sbin/ifconfig -a | nawk '$1 ~ /:$/ && $1 {sub(":$", "", $1); print... (3 Replies)
Discussion started by: ak835
3 Replies

8. Linux

Scripting advice needed

Evening all, Im trying to get a script that will: Select the most 3 recent files in a specific directory Run a command on them (like chmod) Ask of you would like to continue Copy the files to another directory If a linux guru could help me out, it would be very much appreciated. Thanks... (2 Replies)
Discussion started by: Wiggins
2 Replies

9. UNIX for Dummies Questions & Answers

Help needed for nohup time

Hi All, Firstly thanks for reading my query..I am a complete newbie in Unix and I recently read about nohup command which is responsible to continue execution in background. But I have found some command where time is used alongwith nohup as given below:- nohup time A.sh & I don't know why... (2 Replies)
Discussion started by: saswati16
2 Replies

10. Solaris

Solaris Study Advice Needed

I just have a question regarding learning Solaris, I have a Linux and AIX background and I would like to learn Solaris, I have been giving some Solaris 10 Study Guides and just wondered how relevant they would be to Solaris 11 or should I try and get some study materials which are targeted towards... (1 Reply)
Discussion started by: markmorris182mx
1 Replies
xlator_call(8)						      System Manager's Manual						    xlator_call(8)

Name
       xlator_call - shell script to invoke PostScript translators

Syntax
       xlator_call datatype orientation pagesize width length indent

Description
       This  Bourne  shell script can be called by the line printer daemon to invoke the appropriate translator to convert each data type to Post-
       Script.	The data type passed by may be specified by using the command with the -Ddatatype option, or by using the  Da=datatype	capability
       in the file.

       For a file in a data syntax to be translated to PostScript, the script must contain a case branch which recognizes the data type string and
       calls a suitable filter.  The supplied recognizes the ANSI, ASCII, ReGIS and Tektronix 4014 data types.

Arguments
       datatype
       The valid data types are: or any other for which a translator has been installed.

       orientation
       The valid orientations are: portrait or landscape.

       pagesize
       The valid page sizes are: or

       width
       The width (in characters) of the page.

       length
       The length (in lines) of the page.

       indent
       The amount (in spaces) the output is to be indented.

       All the valid arguments are described in detail by the reference page.

Examples
       An example shell script is shown below:
       case $datatype in
       ansi)
	    exec ansi_ps -F $pagesize -O $orientation -e "$@";;
       ascii)
	    echo "(04) cvn {} def"
	    exec ln03rof -w$width -l$length -i$indent;;
       postscript)
	    exec cat;;
       tek4014)
	    exec tek4014_ps -F $pagesize -O $orientation;;
       regis)
	    exec regis_ps -F $pagesize -O $orientation;;
       *)
	    echo "$0: Translator for data type $datatype not installed" >&2
       esac

       When the shell script is called, the path searched is:
       /usr/local/lib/lpdfilters:/usr/ucb:/bin:/usr/bin:
				   /usr/lib:/usr/lib/lpdfilters

Files
       The				       script

See Also
       lno3rof(8), printcap(5), ansi_ps(8), lpd(8)

																    xlator_call(8)
All times are GMT -4. The time now is 04:40 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy