calling a Universe program


 
Thread Tools Search this Thread
Top Forums UNIX for Advanced & Expert Users calling a Universe program
# 1  
Old 02-16-2009
calling a Universe program

Can someone offer some technical advice concerning an call to a IBM U2 (Universe) program?
When I use the following script from a unix shell, it works fine:
$ " xxx.sh "
(contains the following --->)
1. cd /links/ACCOUNT1
2. /shapps/ibm/uv/bin/uv "COUNT FILE1" /home /result.txt
3. cd -
with the above, I get:

$ cat results.txt
Accepting messages.
ACCOUNT1
Account 88987 records counted.

However, If I enter:
$ "nohup xxx.sh &" it bombs out:
$ nohup xxx.sh & [2] 21477
$ Sending output to nohup.out
[1] + Stopped (tty output) nohup xxx.sh &

This is the part that hangs:
" smintz 26850 26846 0 09:48:33 pts/tNb 0:00 /shapps/ibm/uv/bin/uv COUNT FILE1 "

Does it have somethig to do with (tty output)

$ Any Idea why I can successfully run this .sh from a unix line, but not in the background? Also, I have searched U2 documents on the correct method, cannot find anything, any hints where this is documented?
Thanks
# 2  
Old 02-22-2009
ya2c (yet another 2 cents)

my 2 cents are about /dev/tty and nohup :

- first, you should consider that some applications "like" (*) to open "/dev/tty" ;

- the simplest test you should perform is to force you command to use "/dev/tty" and see if it satisfies your application ;

- speciffically, if you run a shell script in this fashion :

Code:
$ somescript.sh < /dev/tty > /dev/tty

- then your script should not complain about "tty output"

(*) they really shouldn't ; it's poor programming practice .

- second, nohup has 2 relevant properties :

-- it can't afford /dev/tty communication ;

-- it ignores ".profile" sourcing ;

- those two peculiarities above are responsible for most script execution misfortunes ;

- so if you need to run a script thru nohup, be sure to source your ".profile" explicitly within its first few lines ;

good luck, and success !

alexandre botao
# 3  
Old 02-25-2009
about nohup and programming practices

smintz ,

1) programs that explicitly make use of "/dev/tty" are editors (like vi) or other apps that use libcurses ; Any other apps - ordinarilly - should write to stdout and/or stderr , and read from stdin , thus honoring the Unix programming paradigm as set forth by ken thompson since `the epoch' Smilie

-- if you don't recognize some of the info above , it'll be illustrative for you in your journey getting to know Unix better ... so not to worry about it now ;

The point here is that all programmers that stick to the model , can make use of all the power that Unix provides , without any undesired side effects ;

Explicitly , any program that works as below :

Code:
$ prog < input.dat > prog.out 2> prog.err

can be used without worries with all the rest of unix ;

but remember : programs that instead use "/dev/tty" as input and output ,
cannot make use of these facilities ;

** now let's get to nohup ... shall we ?

2) nohup was invented in order to keep a program running even if the user that started it has logged out ... otherwise the program would receive a NOHUP signal upon the user's logoff ;

that said , when a user runs :

Code:
$ nohup prog &

he/she can harmlessly logout and rest assured that his/her program would keep running after logoff ;

obviously if the program has anything to tell , who would be there to hear , if the user bailed out ?

this is taken care of by means of the 'nohup.out' file (provided automatically by nohup) ;

the point here is : "any program subjet to nohup MUST adhere to the Unix I/O programing model" , that is , it's i/o MUST be "redirectable" as shown above ;

this is why nohup can't handle "/dev/tty" communication ;

and this is why a "good use" of nohup includes redirecting all i/o ;

** now explicitly - if you use it like :

Code:
$ nohup prog < input.dat > prog.out 2> prog.err &

than everything works fine ... provided that "prog" is a well-behaved application ;

*** now , with regard to shell scripts , just bear in mind that the shell itself is a programm , and "your application" (whatever it may be) is another application, and whoever goes into background MUST redirect its I/O , ok ?

just one last thing ... using ">" and "1>" has the same effect , so

Code:
$ prog > fileA 1> fileB

has no meaning ... you will not have a duplicated output ;

-- hope this starts your clarification on the subjects ;

good luck , and success !

alexandre botao ( Alexandre V. R. Botao | Unix, C/C++, Shell, LDAP, SSL/TLS, SSH, Perl, Java, Python, Security, ... )
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Programming

Program crashes on calling __libc_msgrcv()

Hi, I am a newbie to linux programming. I have implemented msgqueue in C. msgrcv() call at the client end is as below: msgrcv( msgqid, msgptr, msgsize, msgtype, 0 ); My program works fine when msgrcv () from /lib/libc.so.6 is called. However it crashes when __libc_msgrcv() is called. ... (3 Replies)
Discussion started by: praasanna
3 Replies

2. Homework & Coursework Questions

Calling compiled C program with Perl program

Long story short: I'm working inside of a Unix SSH under a bash shell. I have to code a C program that generates a random number. Then I have to call the compiled C program with a Perl program to run the C program 20 times and put all the generated random #s into a text file, then print that text... (1 Reply)
Discussion started by: jdkirby
1 Replies

3. Programming

Calling a shell script from a C program

Hi, I have a shell script which connects to a database and fetches the count of the records from a table. I want to embed this whole script in a C program. Also the count fetched should be available in the C program for further usage. Please let me know how this can be done. Thanks (9 Replies)
Discussion started by: swasid
9 Replies

4. Shell Programming and Scripting

Calling a shell script from a C program

Hi, I have a shell script which connects to a database and fetches the count of the records from a table. I want to embed this whole script in a C program. Also the count fetched should be available in the C program for further usage. Please let me know how this can be done. Thanks ... (0 Replies)
Discussion started by: swasid
0 Replies

5. UNIX for Dummies Questions & Answers

Calling a c program using perl script

On bash I run precompiled c Program as follows: ./create_cust 1 10000 US S > us_cust.csv create_cust is a c program and requires 4 parameters. I am redirecting the output of this program to csv file I need to run this same program in perl I am aware of exec command though not... (7 Replies)
Discussion started by: gkbond
7 Replies

6. Shell Programming and Scripting

calling a program (w/ params) from within shell

Hi all, I need to call some script (s1) from within my shell script (s2). s1 accepts parameters and I want to feed it with values of params from my script. I tried many things but none work (I am so much of a beginner), please help one of my attempts : . . . param1="hehe" param2="haha" ... (12 Replies)
Discussion started by: Lorna
12 Replies

7. Shell Programming and Scripting

Calling Functions of Other K Shell Program

Hi, I have a K shell a.ksh function abc { // Some logic } In b.ksh i have included the a.ksh ./a.ksh I want to call the abc function from this b.ksh script. Thanks Vijay (2 Replies)
Discussion started by: vijaykrc
2 Replies

8. UNIX for Advanced & Expert Users

calling program

hi, i have a script.sh on my machine and it used in the system but my question is how can i know the program called this script.sh?? i.e. from where it called and execute?? Many thanks (1 Reply)
Discussion started by: alzuma
1 Replies

9. Shell Programming and Scripting

Calling SHELL script from C program

Hi, I just tried to call a simple script from a pretty simple C program. I could not succeed :-( a message was thrown saying "sh: line 1: "Script name with path": Permission denied" The C program and shell script are below, both are in the same directory and shell script is given... (7 Replies)
Discussion started by: Chanakya.m
7 Replies
Login or Register to Ask a Question