Nested calls


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Nested calls
# 1  
Old 08-04-2002
Question Nested calls

Hi all,
I have two questions:
1. I have a script (call it A) that call another script (call it B) which in turn call another script (call it C). The strange thing is that when script C hangs script A exists (i.e., will not appear when I call ps command to list all the running processes). Is my observation is correct ? if so, how I call prevent A from disappearing?
2. Is there a max. number of nesting when calling procedures?
Thank you in advance
Best Regards
# 2  
Old 08-04-2002
1. No, you must be in error. I do that all the time. Unless script C worked very hard to locate and explicitly kill script A, script A should be fine.

2. There is no limit imposed by the shell, but computers are finite state machines. Eventually you will run out of process table entries or swap or some other resource.
# 3  
Old 08-05-2002
Thank you very much
# 4  
Old 08-09-2002
Hi again,
I have script A, that calls script B, in turn script B calls ftp. When ftp hangs only process A is shown when typing ps -ef command, script B is no longer exist. How can I prevent that. since I understand from the previous discussion that this is not possible. However, this occurs with me as shown in the snap shot below (which is taken at Aug. 8th) script A is ftpDC_lock and script B is called ftpDC (not shown). What ftpDC_lock do is it check if ftpDC is running if yes it will not fire ftpDC otherwise it will call it.
Thank you in advance
Best Regards

#date
Thu Aug 8 08:54:15 UTC 2002
# ps -fuboaadm
UID PID PPID C STIME TTY TIME COMD
boaadm 391 1 0 Jul 27 console 0:00 -ksh
boaadm 3798 3797 0 Jul 27 ? 3:09 oracleA P:4096,3,6,
boaadm 3797 1 0 Jul 27 ? 0:23 both -d
boaadm 325 1 0 Jul 27 ? 0:00 monitor 1024000 1024000 60 0
boaadm 3799 3796 0 Jul 27 ? 0:00 oracleA P:4096,3,6,
boaadm 496 391 0 Jul 27 console 0:05 runmenu50 boa -c AT386:AT386 -m p
boaadm 26251 247 0 Aug 03 ? 0:00 sh -c /usr/boa/bin/ftpDC_lock.sh >>/usr/boa/log/ftpDC_lock.log 2>&1
boaadm 491 1 0 Jul 27 console 0:00 vtlmgr
boaadm 3796 1 0 Jul 27 ? 0:00 bout -h24 -s10 -d
boaadm 499 496 0 Jul 27 ? 0:11 oracleA P:4096,6,9,
boaadm 26260 26253 0 Aug 03 ? 0:00 /usr/boa/bin/ftpDC_lock.sh
boaadm 2598 491 0 Jul 27 vt01 0:00 ksh
boaadm 26253 26251 0 Aug 03 ? 0:00 /usr/boa/bin/ftpDC_lock.sh
boaadm 26331 26260 0 Aug 03 ? 0:00 ftp -n
#
# 5  
Old 08-09-2002
boaadm 26331 26260 0 Aug 03 ? 0:00 ftp -n

In the line above, 26331 is the pid of the ftp process, and 26260 is the pid of the parent of the ftp process. Should that parent die, the ppid will switch to 1 and init will become the new parent. Since the ppid is not 1, the parent process has not died.

This means one of two things:

1) You are mistaken and there simply is no script B. Script A itself is invoking ftp. (There may be a script B that does something else and then exits, but it didn't invoke that ftp process.)

2) There was a script B, but instead of running ftp, it did an "exec ftp". The exec command causes the new program to overlay the old one. You can never return from an exec. The old program is gone.
# 6  
Old 08-09-2002
Thank you again for your help...
Actually I am the person that program all these scripts. Therefore, I am sure that script A will first check if script B is running is Yes it will do nothing otherwise script B will be called. In turn script B will call ftp using the following command
ftp -n
In this case PID of the parent was not 1 but on other occusion it is 1. Thank what makes me confused...

Best Regards
# 7  
Old 08-16-2002
Hi...
I discovered the reason why process B diappear from the set of processes wjen using "ps -ef" . In the code of script A, I call script B by just typying its name (w/o sh) since it is excutable. When I use "sh A" it appears in the set of perocesses. Do you why this happens? I mean the effect of sh?
Thanks
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

system calls in C

Hello, how would i be able to call ps in C programming? thanks, ---------- Post updated at 01:39 AM ---------- Previous update was at 01:31 AM ---------- here's the complete system call, ps -o pid -p %d, getpit() (2 Replies)
Discussion started by: l flipboi l
2 Replies

2. Shell Programming and Scripting

c++ calls bash

hi, i'm a noob i have a quuestion: is possible to call and run the bash script by c++ program? if so, is it posible in grafic? specially Qt ? thanks (8 Replies)
Discussion started by: 3.14.TR
8 Replies

3. UNIX for Dummies Questions & Answers

About system calls.

Hi all, I am new here . I want to know about system call in detail. As system calls are also function .How system identifies it.:) (2 Replies)
Discussion started by: vishwasrao
2 Replies

4. BSD

system calls

what is the functions and relationship between fork,exec,wait system calls as i am a beginer just want the fundamentals. (1 Reply)
Discussion started by: sangramdas
1 Replies

5. Programming

System calls

why user is not able to switch from user to kernel mode by writing the function whose code is identical to system call. (1 Reply)
Discussion started by: joshighanshyam
1 Replies

6. IP Networking

Identification of data calls & voice calls

Is there any facility to filter/identify the data calls and voice calls coming throug modem? OR Can we get the data or voice calls information through a script(preferably C Kermit)? (0 Replies)
Discussion started by: pcsaji
0 Replies

7. Solaris

System calls ?

where can i find the differences in System calls between solaris and aix? also is it possible to find a comprehensive list of them? (1 Reply)
Discussion started by: TECHRAMESH
1 Replies

8. UNIX for Dummies Questions & Answers

System calls?

open, creat, read, write, lseek and close Are they all primitive? :confused: *Another Question: is there a different between a system call, and an i/o system call? (2 Replies)
Discussion started by: PlunderBunny
2 Replies

9. UNIX for Dummies Questions & Answers

System calls for cp and mv

Which system calls are made for operations cp and mv (2 Replies)
Discussion started by: gaurava99
2 Replies

10. UNIX for Dummies Questions & Answers

System Calls

What does the system call "dup" do? What is the difference between dup and dup2 I have a fair idea of what it does but I am confused when its coming down to the exact details... Please help me!:confused: (2 Replies)
Discussion started by: clickonline1
2 Replies
Login or Register to Ask a Question