Operating System - HP-UX
1757086 Members
1711 Online
108858 Solutions
New Discussion юеВ

Re: time command. Getting a return code 2 from a time command

 
SOLVED
Go to solution
Wayne Moyer
Advisor

time command. Getting a return code 2 from a time command

I an starting a process using a time command in a script. When I test the return code sometimes I get a return code of 2. This just stated happening this morning and it happens intermittently. Where can I find the reason for the return codes. Has anyone else seen this?
7 REPLIES 7
James R. Ferguson
Acclaimed Contributor

Re: time command. Getting a return code 2 from a time command

Hi Wayne:

I believe that you are seeing the return code of the command or process that you are timing. For example, consider this:

# grep SOMETHING /etc/NOFILE; echo $?
grep: can't open /etc/NOFILE
2

# time grep SOMETHING /etc/NOFILE;echo $?
grep: can't open /etc/NOFILE
real 0.0
user 0.0
sys 0.0
2

Regards!

...JRF...

Wayne Moyer
Advisor

Re: time command. Getting a return code 2 from a time command

This is the message we are getting and then check the RC.

time: command terminated abnormally.
James R. Ferguson
Acclaimed Contributor

Re: time command. Getting a return code 2 from a time command

Hi (again) Wayne:

Posting the actual code you are running when you receive the error along with a clear notation of the release (from 'uname -a') whould be helpful.

You say "a script". I assume that you mean a shell script. If so, what shell? Showing the interpreter line (e.g. #!/usr/bin/sh) would expose that detail.

Regards!

...JRF...
Wayne Moyer
Advisor

Re: time command. Getting a return code 2 from a time command

I attached the script. In there you will see the time command and the return code check.

# uname -a
HP-UX amiadv B.11.11 U 9000/800 2591752923 unlimited-user license

Thanks.
James R. Ferguson
Acclaimed Contributor
Solution

Re: time command. Getting a return code 2 from a time command

Hi (again):

I'm still of the opinion that it is the return code of the process that you are running that you are seeing.

Is '$AMISYS_ROOT_EXECUTE/bin/bcp0100' terminating abnormally, perhaps leaving a 'core' file behind when you get the return code of two?

Regards!

...JRF...
Dennis Handly
Acclaimed Contributor

Re: time command. Getting a return code 2 from a time command

>Where can I find the reason for the return codes.

As JRF said and your script comments indicate, the return code comes from bcp0100:
echo 'Program bcp0100 called ABORT/QUIT: time'

The message "time: command terminated abnormally" indicates bcp0100 got a signal.
Signal 2 is SIGINT.

>JRF: I'm still of the opinion that it is the return code of the process

Exactly.

>perhaps leaving a 'core' file behind when you get the return code of two?

No core files for SIGINT.
Wayne Moyer
Advisor

Re: time command. Getting a return code 2 from a time command

Thanks for the response.