different behaviour in fg and bg


 
Thread Tools Search this Thread
Top Forums Programming different behaviour in fg and bg
# 1  
Old 12-09-2011
different behaviour in fg and bg

fg = foreground bg = background
I have a cobol program that I start with a very simple script.
The script is not at fault as it has not changed and the program worked in fg and bg before.
I have altered the logging in the program and moved my cursor declare to working storage.
The program runs as a daemon sleeping and checking every minute if it needs to run.
now when I run in foreground - it works creating the log file and reading the records from the oracle database
when run ./start_script& (in background)
no log file in /tmp
no records selected from oracle although in exact state as those set for foreground test?
Any help appreciated

Regards
Bruce
# 2  
Old 12-09-2011
What happens when you execute fg after running the program in the background? Does it start going?
# 3  
Old 12-09-2011
I will try that on Monday as I am off home now thanks for the reply
# 4  
Old 12-15-2011
When started in bg the log file is not created database not accessed
When brought into fg then the program runs exactly as expected
# 5  
Old 12-15-2011
And nothing else changed on your system? What OS and more specifically what cobol ?
# 6  
Old 12-15-2011
nothing else changed
Code:
(3,audev)/usr4/i/xj410235/bin $ cd /usr1/au/scripts
(3,audev)/usr1/au/scripts $ ./xjr1405_start &
[1] 29330
(3,audev)/usr1/au/scripts $ cd /tmp
[1] + Stopped (tty output) ./xjr1405_start &
(3,audev)/tmp $ ls -lrt XJ* | grep 'Dec 15'
-rw-rw-rw- 1 G774AHE users 641 Dec 15 10:16 XJR1405_20111215093926
.log
-rw-rw-rw- 1 G774AHE users 7623 Dec 15 10:25 XJR1405_20111215093429
.log
-rw-rw-rw- 1 G774AHE users 11137 Dec 15 11:17 XJR1405_20111215103729
.log
-rw-rw-rw- 1 G774AHE users 33136 Dec 15 11:36 XJR1405_20111215112743
.log
(3,audev)/tmp $ ps -ef | grep xj
G774AHE 199 27651 1 13:19:14 ttyp8 0:00 grep xj
G774AHE 29336 29330 0 13:18:05 ttyp8 0:00 /usr/local/bin/oraclerun /usr1/a
u/bin/xjr1405
G774AHE 29330 27651 0 13:18:05 ttyp8 0:00 /bin/ksh ./xjr1405_start

unix is HP-UX; cobol is microfocus cobol server express v5.0; Oracle 9i

This is repeatable - but if started in fg and ctrl-Z issued then process remains functional

Last edited by Bruble; 12-15-2011 at 11:56 AM..
# 7  
Old 12-16-2011
I dont think it has to do with cursor declaration, but what about your alteration can you say more?
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Red Hat

Ps command different behaviour

Hi Experts, ps command behavior in Redhat is such that it outputs all the output(of long lengths). In Unix the ps command output was limited to only 80 chars. In that if you pipe its output to another command hen the 80 chars restriction wouldn't be there. This 80 char limitation will only be... (14 Replies)
Discussion started by: Albert_Pinto7
14 Replies

2. Programming

Sort behaviour

I see strange results when sorting with -n options and I wander if somebody can explain it. Input file and two results: $ cat aa 14 -1 11 -1 0 -1 0 $ sort -u aa -1 0 (1 Reply)
Discussion started by: migurus
1 Replies

3. Ubuntu

Weird rm behaviour

I am little bit confused by the behaviour of rm in Ubuntu. It seems that as a regular user I can delete files owned by another user even when the permissions are set to 644. Here is an example: cjohnson@carbon:~/test$ sudo touch testfile cjohnson@carbon:~/test$ ls -al total 8 drwxr-xr-x... (2 Replies)
Discussion started by: ccj4467
2 Replies

4. UNIX for Advanced & Expert Users

eval behaviour

Hi, I have snippet like the following x="1" prompt1="hi" if I say eval echo \$prompt$x then it is giving o/p "hi" if I say `eval echo \$prompt$x` here it is giving 1 ! if I add one more escape character i.e. `eval echo \\$prompt$x` then it is giving "hi" Can you please... (3 Replies)
Discussion started by: shahnazurs
3 Replies

5. Shell Programming and Scripting

cp -R behaviour

i 've noticed the following difference between freebsd cp and gnu cp from the freebsd cp man page: -R ... If the source_file ends in a /, the contents of the directory are copied rather than the directory itself. ... on gnu cp from the man pagewhile on gnu cp manpage: ‘-r'... (2 Replies)
Discussion started by: aegis
2 Replies

6. Shell Programming and Scripting

Why this behaviour of IF condition?

I have a variable, defndata, which is a number (fetched from a file using awk). I want that if defndata is not initialized (that is its not found in the file using awk), then to execute a block of statements, otherwise execute another block. if then .... else ... fi Now this... (4 Replies)
Discussion started by: indianjassi
4 Replies

7. Shell Programming and Scripting

A Strange Behaviour!!!

Can some-one give me a view to this : I have a directory in an unix server, having permissions r-xr-xr-x .This directory is basically a source directory. Now there is another directory basically the destination directory which has all the permissions. Note:I log in as not the owner,but user... (5 Replies)
Discussion started by: navojit dutta
5 Replies

8. Programming

Different behaviour of this program

Hi, I have one doubt, in the below program, if I declare char *b inside the main(), the function compiles & runs properly. But at the same time, if I declare it globally it compiles but when we run it, it creates core dump (segmentation fault) both in C & C++. It is not being trapped by catch... (7 Replies)
Discussion started by: royalibrahim
7 Replies

9. Shell Programming and Scripting

Count behaviour when using su -

Gentlemen, OK, I have an odd issue here perhaps someone can shed some light for me. When running a script as its user/owner the below pause/wait works just fine. When a developer has used su - to assume the username the pause does not happen... This is a HPUX11.00 machine, I have copied the blurb... (1 Reply)
Discussion started by: Eronysis
1 Replies
Login or Register to Ask a Question