Job Completion Information?


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Job Completion Information?
# 1  
Old 08-02-2007
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  
Old 08-02-2007
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  
Old 08-02-2007
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  
Old 08-02-2007
Quote:
Originally Posted by davidfrank
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 05:33 AM..
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Bash-Completion, an example

Hello I've followed several bash-completion threads, usualy none were answered, because of obvious reasons. (of which i'm just aware since a day or a few) Non-the-less, because i was writing scripts, i never considered it to be possible to add this functionality. Also, because i though that... (0 Replies)
Discussion started by: sea
0 Replies

2. Shell Programming and Scripting

I want a script to view the complete log information of data stage job from UNIX IBM AIX.

Hi, I am working on data stage 8.7 version and I want a script a to view the all log information of the data stage job from UNIX environment. Can you please help me out by give the script. Thanks in advance... (7 Replies)
Discussion started by: victory
7 Replies

3. UNIX for Dummies Questions & Answers

How to findsuccessful job status completion in Autosys, programatically

We are using autosys for job scheduling. How to find successful job status completion in Autosys, programatically. Based on the successful job completion , mail has to be trigeered to Business users. Please help Thanks (0 Replies)
Discussion started by: vkalya
0 Replies

4. Shell Programming and Scripting

Script to Start a Job after finding the Old job completed

Hi Experts, I need a script advice to schedule 12 jobs ( SAS Codes execute back ground ). Algorithem: 1. Script checks first job. 2. Finds first job is done; invoke second job. 3. finds second job is done; invoke third job. .. Request you to please assist. (3 Replies)
Discussion started by: Jerald Nathan
3 Replies

5. UNIX for Advanced & Expert Users

Completion time of a cron job ?

how can we identify the task completion time which was initiated by CRON. we have 1000 of jobs whihc are runing from cron so it is not feasable to edit every cron entry or every script to add the respective code to find teh completion time. Can some one please provide a inut to find the task... (3 Replies)
Discussion started by: NIMISH AGARWAL
3 Replies

6. UNIX for Dummies Questions & Answers

cron job not running to completion

am running a cron job to do a backup of all user files. the script runs properly in the terminal but only backups about 20% of the files when run by cron. the Linux system is running BASH as far as I can tell. the symbols $FILE and $DIRECTORY are defined properly and the following is the... (1 Reply)
Discussion started by: novice633
1 Replies

7. OS X (Apple)

Get print job information

Hi all, I am on a mac and I am trying to get more information about print jobs i have. "lpq" only displays the document printing, size, and job ID. I need the status (if its on hold or not). Anyway to do that in unix/cups? (5 Replies)
Discussion started by: CBarraford
5 Replies

8. Solaris

killing a unix job after the job process gets completed

Hi, Thanks in advance. i need to kill a unix background running job after that job process completes. i can kill a job by giving the following unix command kill -9 processid how to kill the job after the current process run gets completed ? Appreciate your valuable help. Thanks... (7 Replies)
Discussion started by: dtazv
7 Replies

9. Shell Programming and Scripting

killing unix job after the job process completes

Hi, Thanks in advance. i need to kill a unix background running job after that job process completes. i can kill a job by giving the following unix command kill -9 processid how to kill the job after the current process run gets completed ? Appreciate your valuable help. ... (1 Reply)
Discussion started by: dtazv
1 Replies

10. UNIX for Dummies Questions & Answers

Cron Sends mail to root on completion of job.

All I am running a few scripts through a cron job. This is for checking some key services that are running on by box. The problem is, everytime the cron runs, it sends a mail to the root account. The root account mails need to cleared every now and then. Is there some way I can stop these... (1 Reply)
Discussion started by: skotapal
1 Replies
Login or Register to Ask a Question