The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
.
google unix.com



UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Monitoring SCP for completion thumper UNIX for Dummies Questions & Answers 2 03-29-2008 03:38 AM
Tab completion in csh James McMurray Shell Programming and Scripting 3 12-12-2007 10:31 AM
Tab completion gubbins GNUless UNIX for Dummies Questions & Answers 2 08-15-2006 11:40 AM
Tab Completion on Solaris 10 annointed3 UNIX for Dummies Questions & Answers 2 01-04-2006 10:25 AM
file name completion rein Shell Programming and Scripting 1 10-10-2005 08:57 AM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 08-02-2007
davidfrank davidfrank is offline
Registered User
  
 

Join Date: Mar 2007
Posts: 10
Job Completion Information?

Hi,

I am trying to get some information on the jobs that are running. I have used the "ps" command, to get information such as 'cpu usage', 'username', 'pid', etc.,

I've also used the "bjobs" command to get information such as 'submit time' and 'start time'. The only thing I need now is to get the 'completion time'.

After several tries, all that I can see is the 'submit time', and 'start time'. How do I get the 'completion time' or 'end time' of a job?

Is there any command that can be used to get the job completion time or atleast the time taken for execution?

Thank you very much for your time and efforts.
  #2 (permalink)  
Old 08-02-2007
congo congo is offline
Registered User
  
 

Join Date: Jun 2006
Posts: 31
an idea

well you can code your programs to log these details in logfiles. This is comon operation in all my programs. You can here also log exit statuses cpu usage af stuff like that.
  #3 (permalink)  
Old 08-02-2007
davidfrank davidfrank is offline
Registered User
  
 

Join Date: Mar 2007
Posts: 10
Thank you for your reply.

I am a beginner in Unix. Can you give some idea as to how I would write these codes. Is there any special command to log these information?

Thanks again.
  #4 (permalink)  
Old 08-02-2007
congo congo is offline
Registered User
  
 

Join Date: Jun 2006
Posts: 31
Quote:
Originally Posted by davidfrank View Post
Thank you for your reply.

I am a beginner in Unix. Can you give some idea as to how I would write these codes. Is there any special command to log these information?

Thanks again.

You can always use
$ echo "Script $0 started @ `date` >> $yourlogfile"
(note that you can modify the date format, to learn more about this try `man date`)

You can grep top 900 or ps -ef for your process (pid of current process is always $$). Note if you grep with $$ you will get first child process(es) out aswell. You can also grep for $0 (program itself), but if running multible times this is not certain.
for exit status you will use $? after a commandline (for instance "ls -l *.txt 2&1>/dev/null";echo $?) --- this means if files was found exit status of ls is 0 (0 is always the good exitstatus), if its greater than 0 it means either ls was flagged bad or it returned no rows.
You will then use $? in an if like "pexitcode=$?;if [ $pexitcode -gt 0 ]; then echo "$0 went bad, exiting with status $pexitcode";fi
(its always a good idea to set $? of a commandline right after, so that you will be able to use it later on

You can always exit your program, with an exitcode/status, note that no code after an exit will be run. You can choose your own exit codes as you wish, dont know if unix core has a limit, but somewhat all you need is less than a hundred...


hope this helps

Last edited by congo; 08-03-2007 at 04:33 AM..
Sponsored Links
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 06:30 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0