Linked Questions

24
votes
2answers
4k views

'tail -f' for a specific amount of time [duplicate]

I need to run tail -f against a log file, but only for specific amount of time, for example 20 seconds, and then exit. What would be an elegant way to achieve this?
12
votes
3answers
26k views

Is there a way to call a command with a set time limit and kill it when that time passes? [duplicate]

Possible Duplicate: Run a command for a specified time and then abort if time exceeds I was working on a continuos integration build script when a need for such a command arose. Basically put, I ...
5
votes
1answer
4k views

How to cat a file for a certain number of seconds? [duplicate]

Possible Duplicate: Run a command for a specified time and then abort if time exceeds Looked all over and I can't find the answer... Simple question: How can I cat a large file for, lets say, 45 ...
2
votes
2answers
8k views

How do I get the nc command to end after 2 seconds? [duplicate]

I have to write a maintenance script that iterates over our IPs testing their connectivity to certain services such as nc -sip# mailin-01.mx.aol.com 25. It has a flag -w ... but it's not what I think ...
0
votes
1answer
3k views

Execute command for x seconds? [duplicate]

Possible Duplicate: Run a command for a specified time and then abort if time exceeds Is there a command which allows me to execute another command for at most x seconds? Imagined example: ...
1
vote
2answers
85 views

How to kill a command run from a script after a period? [duplicate]

I would like to run a never-ending command (such as play a mp3 file in loop) for a period of length T. I put the command in a shell script my.sh: #! /bin/bash vlc /path/to/my.mp3 # will play the file ...
0
votes
1answer
39 views

Getting my ShellScript to run a java file for a given amount of time [duplicate]

I'm trying to get my .sh file to run a Java program for a specific amount of time. Here's my .sh file: #Runs Java Repeatedly. #Reset directory cd #Go until src cd Desktop/Lin\ Lab/Java\ Workspace/...
54
votes
7answers
15k views

Timing out in a shell script

I have a shell script that's reading from standard input. In rare circumstances, there will be no one ready to provide input, and the script must time out. In case of timeout, the script must execute ...
1
vote
2answers
107 views

Send quit keystroke (Q + Enter) to program after running for a certain period of time

Some terminal programs have a quit keystroke to safely stop their execution, for example: Q+Enter From this question I learned that the timeout command allows to send signals to a program after a ...
1
vote
1answer
104 views

How to stop running two programs simultaneously on RPi

I have two active RPi's. They both have the script: adxl345test.py This script collects data from an accelerometer. I usually start the script on one RPi and then start the script on the other RPi. I ...