Start and stop process

Hello,

I wrote a simple script to grab an audio stream and save it into a file.
I need to run this file 5 days a week, the process should record the
stream for ~ 2 hours. What is the best way to approach this problem?

I’m thinking of starting the process with a cron job, on a FreeBSD
server, but then what is the best way to control the process based on
time?

best regards,

Panagiotis (atmosx) Atmatzidis

email: [email protected]
URL: http://www.convalesco.org
GnuPG ID: 0x1A7BFEC5
gpg --keyserver pgp.mit.edu --recv-keys 1A7BFEC5

“As you set out for Ithaca, hope the voyage is a long one, full of
adventure, full of discovery […]” - C. P. Cavafy

I remember there is a gem named “whenever”.

Yuanhang Zheng.
2014-5-13 上午3:47于 “Panagiotis A.” [email protected]写道:

On Mon, May 12, 2014 at 12:46 PM, Panagiotis A.
<[email protected]

wrote:

Hello,

I wrote a simple script to grab an audio stream and save it into a file. I
need to run this file 5 days a week, the process should record the stream
for ~ 2 hours. What is the best way to approach this problem?

I’m thinking of starting the process with a cron job, on a FreeBSD server,
but then what is the best way to control the process based on time?

I’m sure there may be fancier ways - but a pid file and another cron
task 2
hours later that kills the pid is as simple and as clean as you can get.
I
do this exact thing myself and it works like a charm.

John

Subject: start and stop process
Date: Mon 12 May 14 09:46:45PM +0200

Quoting Panagiotis A. ([email protected]):

I’m thinking of starting the process with a cron job, on a FreeBSD
server, but then what is the best way to control the process based
on time?

There is a class called Timeout: “provides a way to auto-terminate a
potentially long-running operation if it hasn’t finished in a fixed
amount of time.”

Carlo