cancel
Showing results for 
Search instead for 
Did you mean: 

nohup and rexec

Suman_7
Frequent Advisor

nohup and rexec

All,

I am having a very strange problem while using rexec.

The command works fine inside a shell script , but when this shell script is executed in nohup mode the script gets hung while trying to execute this command.

Is there any restriction on using recec with nohup or are there any special permissions need to be set for .netrc. I have already set it to 600

Please advice.

Thanks
Suman
10 REPLIES
Bharat Katkar
Honored Contributor

Re: nohup and rexec

Suman,
just a thought:
Could you check the dependancy of your rexec command in your script with the next and previous comamnd in your script.

Hope that helps.
Regards,
You need to know a lot to actually know how little you know
Sridhar Bhaskarla
Honored Contributor

Re: nohup and rexec

Hi Suman,

Other than that the standard out and error are redirected to nohup.out as with nohup, there isn't any restriction. Even if .netrc is wrong, it should prompt you for password. I would check the messages in nohup.out file for clues. It may be somethingelse in the script that is hanging.

-Sri
You may be disappointed if you fail, but you are doomed if you don't try
RAC_1
Honored Contributor

Re: nohup and rexec

If you have tusc,

tusc -vfp nohup "your_rexec script"
To know, where exactly is hanging.

Anil
There is no substitute to HARDWORK
Sanjay_6
Honored Contributor

Re: nohup and rexec

Hi Suman,

When you run the rexec command through the script, is there any interaction. I mean are you required to give any more inputs to make the script work.

Hope this helps.

Regds
Suman_7
Frequent Advisor

Re: nohup and rexec

The script hangs with error message"
[1]tty stopped tty input"

When I cut and paste the same rexec command and put it into a separate shell it works. I am hardcoding the input varibales though.

Please advice.

Thanks
Suman
Sridhar Bhaskarla
Honored Contributor

Re: nohup and rexec

Well, then it's not simple nohup, but with a background job.

That's exactly the message you get if the script in a background is expecting an input. You will need to make sure your script takes care of getting the inputs automatically if you intended to run it in background.

-Sri
You may be disappointed if you fail, but you are doomed if you don't try
Sridhar Bhaskarla
Honored Contributor

Re: nohup and rexec

Hi (Again),

Put a "-n" before the command in rexec as it redirects input from /dev/null.

-Sri
You may be disappointed if you fail, but you are doomed if you don't try
Mark Grant
Honored Contributor

Re: nohup and rexec

remember that nohup closes the standard input. It looks like your script is expecting some input. It may not actually be the rexec itself that is causing you the grief. Does the script work with nohup with the rexec commented out. If it does, could you post your "rexec" command.

Never preceed any demonstration with anything more predictive than "watch this"
Suman_7
Frequent Advisor

Re: nohup and rexec

rexec ${ftp_server} -l ${ftp_user} ls -l ${REMOTE_PATH}/*${parm_date}*.output | awk '{print $6" "$7" "$8}
Sridhar Bhaskarla
Honored Contributor

Re: nohup and rexec

Hi,

As I said, try with -n.



rexec ${ftp_server} -l ${ftp_user} -n " ls -l ${REMOTE_PATH}/*${parm_date}*.output" | awk '{print $6" "$7" "$8}

-Sri
You may be disappointed if you fail, but you are doomed if you don't try