Sponsored Content
Full Discussion: Minutes a program runs.
Top Forums UNIX for Advanced & Expert Users Minutes a program runs. Post 302140676 by 2dumb on Monday 15th of October 2007 10:26:01 AM
Old 10-15-2007
Question Minutes a program runs.

I have a ksh script that executes a program with a predetermined timeout in minutes. If the program takes longer then the timeout then it still completes with a return code of 0. Smilie

I would like to determine how long the program ran. Then if it takes longer than the timeout I would like to specify a new return code. Smilie

I tried to use the time command to display to the screen and log file. Then grab the real time from the output in the log file however I have had not success with redirecting the output to the log file. Smilie

Here is what I am trying to do. See how the output of time does not show up in the log. Smilie
$ time ls home test 2>&1 | tee -a test.log
ls: 0653-341 The file home does not exist.
test

real 0m0.01s
user 0m0.00s
sys 0m0.02s
$ cat test.log
ls: 0653-341 The file home does not exist.
test
There is another problem with this method as well. Depending on what system I run the program on it could take more than an hour to run. Then the real line would return something similar to this “real 4h15m0.23s”. Smilie

Does anyone have a good idea of what I could to determine how long my program is running? Or help me with what I have already started? Smilie
 

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Convert minutes to hours, minutes, seconds

How would you convert lets say a 1000 minutes to hours, minutes, seconds (1 Reply)
Discussion started by: Vozx
1 Replies

2. HP-UX

why does my program runs in conflicting mode?

my pragram runs with 3 threads, 2 work threads, one main thread. the 2 work threads run with the same mode and the same code. but now, one of the work thread can't work, and it uses the cpu more than 80%, sometimes uses 100% cpu resource. the another work thread work well. when I viewed the HP... (2 Replies)
Discussion started by: happylife365
2 Replies

3. Shell Programming and Scripting

Check if a program runs on unix

Hi guys, I had a question last week where I asked how I check from a website hosted on windows if a process is running on on of our unix servers. Vino and Shell Life kindly replied with a perl script: if qm') -gt 0 ] ; then echo "Site is up" else echo "Site is down." # start the... (1 Reply)
Discussion started by: drchris
1 Replies

4. Programming

getting Segmentation Fault (core dumped) error but Program runs fine.

i am executing following program int main() { char str; FILE * fp; int i=0; ... (4 Replies)
Discussion started by: bhavesh.sapra
4 Replies

5. Shell Programming and Scripting

crontab runs only one line in iterated program

I have a crontab as below: PATH=/usr/local/sbin:/bin/:..... etc etc 0 8 * * * /home/user/jobs/poll.sh 2>/dev/null 1>/dev/null Now the script poll.sh is called at correct time and executes. This is how poll.sh looks like #!/bin/bash... (2 Replies)
Discussion started by: chakrapani
2 Replies

6. Homework & Coursework Questions

create a program that runs two processes linked oven

I need help program in C... :create a program that runs two processes linked oven (1 Reply)
Discussion started by: gizmo16
1 Replies

7. UNIX for Beginners Questions & Answers

How to convert days hours minutes seconds to minutes?

Hi, please help with below time conversion to minutes. one column values: 2 minutes 16 seconds 420 msec 43 seconds 750 msec 0 days 3 hours 29 minutes 58 seconds 480 msec 11 seconds 150 msec I need output in minutes(total elapsed time in minutes) (2 Replies)
Discussion started by: ramu.badugula
2 Replies

8. Shell Programming and Scripting

Grep a log file for the last 5 minutes of contents every 5 minutes

Hi all, System Ubuntu 16.04.3 LTS i have the following log INFO 2019-02-07 15:13:31,099 module.py:700] default: "POST /join/8550614e-3e94-4fa5-9ab2-135eefa69c1b HTTP/1.0" 500 2042 INFO 2019-02-07 15:13:31,569 module.py:700] default: "POST /join/6cb9c452-dcb1-45f3-bcca-e33f5d450105... (15 Replies)
Discussion started by: charli1
15 Replies

9. UNIX for Beginners Questions & Answers

Where can I find the program that runs the -wc command?

Hey guys, I was wondering. When I enter a command in the terminal -wcl for a word count, where is that program located in the kernel? (7 Replies)
Discussion started by: Circuits
7 Replies
OCF_HEARTBEAT_EVMSSC(7) 					OCF resource agents					   OCF_HEARTBEAT_EVMSSC(7)

NAME
ocf_heartbeat_EvmsSCC - Manages EVMS Shared Cluster Containers (SCCs) (deprecated) SYNOPSIS
EvmsSCC [start | stop | status | monitor | meta-data] DESCRIPTION
Deprecation warning: EVMS is no longer actively maintained and should not be used. This agent is deprecated and may be removed from a future release. -- Resource script for EVMS shared cluster container. It runs evms_activate on one node in the cluster. SUPPORTED PARAMETERS
ignore_deprecation If set to true, suppresses the deprecation warning for this agent. (optional, boolean, default false) SUPPORTED ACTIONS
This resource agent supports the following actions (operations): start Starts the resource. Suggested minimum timeout: 60. stop Stops the resource. Suggested minimum timeout: 60. notify Suggested minimum timeout: 60. status Performs a status check. Suggested minimum timeout: 10. Suggested interval: 10. monitor Performs a detailed status check. Suggested minimum timeout: 10. Suggested interval: 10. meta-data Retrieves resource agent metadata (internal use only). Suggested minimum timeout: 5. EXAMPLE
The following is an example configuration for a EvmsSCC resource using the crm(8) shell: primitive p_EvmsSCC ocf:heartbeat:EvmsSCC op monitor depth="0" timeout="10" interval="10" SEE ALSO
http://www.linux-ha.org/wiki/EvmsSCC_(resource_agent) AUTHOR
Linux-HA contributors (see the resource agent source for information about individual authors) resource-agents UNKNOWN 03/09/2014 OCF_HEARTBEAT_EVMSSC(7)
All times are GMT -4. The time now is 05:51 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy