possibility to call subprocesses from ksh ??


 
Thread Tools Search this Thread
Top Forums UNIX for Advanced & Expert Users possibility to call subprocesses from ksh ??
# 1  
Old 12-11-2002
Bug possibility to call subprocesses from ksh ??

Hi!!

Is there a possibility to call/start a subproces using ksh ??
Hope that there is somebody to help me.

thanks in advance.

Corine
# 2  
Old 12-11-2002
That is pretty much the normal case. Smilie

Code:
#! /usr/bin/ksh
date
exit 0

In the above script, the date command will be a subprocess of ksh. A few commands like "echo" are built-ins so they are not run as subprocesses.
# 3  
Old 12-11-2002
What I meant to say was using the nohup to call a script in another script.

So something like:

nohup ./dump.sh databasename &

And then that line in another script.
Is that possible ?
Or do I need to call the mainscript with nohup and just put the line:

./dump.sh databasename

in the script?

I hope you understand what I mean.
# 4  
Old 12-11-2002
You can use nohup inside a script if you want to. But I think nohup was really intended to be used from the command line.

Different versions of nohup ignore different signals. Sun actually supplies two different versions. It writes to nohup.out if it can or $HOME/nohup.out if the current directory is not writable. A script that silently invokes nohup might interfer with a user's use of nohup with both writing to the same nohup.out file.

Inside a script, ignoring signals is easy. A script can in effect nohup itself by simply using:
trap "" HUP QUIT
and there is no question about whether or not QUIT is being ignored. Want to ignore TERM too? Just use:
trap "" HUP QUIT TERM
And now you can redirect the output whereever you want leaving nohup.out available for mamual use.

In my above script, you could do:
nohup date &
but
( trap "" HUP QUIT TERM ; exec date > date.out 2>&1 ) &
pretty much does the same thing, but gives me much more control over what is happening. Remember that parentheses start a subshell, so the trap inside the subshell does not affect the outer shell.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How to call a power shell script from ksh or sh?

Hi, I have some .json scripts and azure commands in powershell script and I need to execute this powershell script from unix console by writing a shell script. But these powershell script is under my local for ex. C:\ drive. Would it be possible to achieve this? And do we need to install... (1 Reply)
Discussion started by: Samah
1 Replies

2. Shell Programming and Scripting

Shells, forks, subprocesses... oh my

all, i've been reading to try and get an abstract idea of the process effeciency of commands , sed, bash, perl, awk, find, grep, etc which processes will spawn?, fork?, launch subshell?, etc and under what conditions? how do you know which commands have the faster and better stdio... (2 Replies)
Discussion started by: f77hack
2 Replies

3. UNIX for Dummies Questions & Answers

How to kill a script and all its subprocesses?

I'd like to terminate scripts. These scripts are not by me, but other persons. These contain other programs such as ping, nmap, arp, etc. If such a script is running, how can I terminate this script AND all processes called by this script? These scripts are big so terminating all programs... (4 Replies)
Discussion started by: lordofazeroth
4 Replies

4. Shell Programming and Scripting

Not able to call an element from an array in ksh

Hi, I have: # Initialize variables #!/usr/bin/ksh FILENM=$1 INDEX=0 # read filename echo "You are working with the Config file: $FILENM" while read line do echo $line data=$line ((INDEX=INDEX+1)) done <"$FILENM" (3 Replies)
Discussion started by: Marc G
3 Replies

5. UNIX for Dummies Questions & Answers

What is meant by subprocesses?

I'm going through my UNIX book and came across a section on Customization and Subprocesses. Can someone tell me what a subprocess is -- for example, when the book says "Which shell 'thing' are known to subprocesses" what exactly does it mean? The book just talks about it without defining it... (10 Replies)
Discussion started by: Straitsfan
10 Replies

6. Shell Programming and Scripting

HELP. Oracle Call from ksh script

I have searched the forums and couldn't find my specific issue so I figure that I would post on it. I am trying to run a simple sql script that spools to a flat file from a unix script. I have tried to make the call outright from inside of the ksh script as such: sqlplus... (3 Replies)
Discussion started by: BkontheShell718
3 Replies

7. Shell Programming and Scripting

Not getting the out value parameter of a DB call in the ksh file

Hi all Im calling a DB procedure as foll sqlplus -s $DB_USERID/$DB_PASSWD@$DB_NAME<<eof var var1 VARCHAR2(200); exec ODAS_BATCH_JOBS_RETRIEVE.retrieve_user_info(:var1); eof echo $var1 This echo is giving a blank. Also in case the package ODAS_BATCH_JOBS_RETRIEVE is in an un compiled... (2 Replies)
Discussion started by: Sam123
2 Replies

8. Shell Programming and Scripting

how to call a .bat file using KSH

Hi all, I am a very new user for korn scripting and in a process of learning. i have a .bat file that calls a .vbs file which calls a macro used to convert an excel spread sheet to .csv file... Now i want to automate this process. I want to call this bat file using a korn script or a korn... (16 Replies)
Discussion started by: bhagya2340
16 Replies

9. Shell Programming and Scripting

How to call the ksh script when rebooting the server

Hi all, Can any one help me....... I just want to run one shell script whenever i am rebooting the server. Is there any easy way to do that???? Thanks, selva (7 Replies)
Discussion started by: Selva_Kumar
7 Replies

10. Shell Programming and Scripting

How to call Java classes/methods from ksh

Hi all, i am new to shell scripts and have one doubt. Can we call ava classes/methods from shell scripts? if yes how? (17 Replies)
Discussion started by: girish.sh
17 Replies
Login or Register to Ask a Question