cron problem (duplicate mencoder jobs)?

Hello - Please forgive me is this is the incorrect forum for this post ...

I have a Hauppauge PVR-500 ("dual PVR-150") TV tuner card, installed under Ubuntu 8.04 LTS (64-bit). I wrote a simple bash script to record programs using the /dev/video0 or/and the /dev/video1 cards. I use a separate script to schedule recording times, using "at commands," that are executed by my local crontab (user crontab -e).

I've noticed that if I schedule simultaneous recordings in cron, I run into problems, e.g. one recording won't start until the first is complete, if both are schedules to start at the same time, and end at the same time. If I "nest" one recording (e.g. 30 minutes on tuner 1) that occurs after a longer recording (e.g. 2 hours) on tuner 0) has started, then the one on tuner 1 records successfully, but the one on tuner 2 does not quit but rather continues to re-record, continually overwriting the intended recording.

When I check my running processes (system activity), I see that one or two instances of mencoder are still running (I'm typing this from memory, at work).

I believe that this is a cron / process ID (pid) / scheduling conflict. I did a lot of Google searches (e.g.: cron, mencoder, simultaneous, scheduling, conflicts, fifo, tee, etc.) but I am unable to see a simple explanantion / solution.

Can anyone address the issue of how to get two instances of mencoder to operate, simultaneously, without interfering / conflicting with one another? For example, could I specify unique PID's (how?)? ...

Thank you, appreciated! Greg :slight_smile:

This is interesting ... I've been playing with test recordings of 1 min 5 sec, simultaneously programming captures from /dev/video0 (PVR-500 tuner 1) and /dev/video1 (PVR-500 tuner 2), using mencoder encoded in one bash file, and scheduled via "at" commands in a second bash script.

When I do it as described, the first recording executes and completes, then a little more than a minute after the intended start time, the second recording starts and executes.

I then repeated this, *but* I left Ubuntu's System Monitor (System > Administration > System Monitor) *open,* so that I could watch what was happening. By leaving the System Monitor window open, *two* separate mencoder processes launched, simultaneously. Both scheduled programs recorded, *simultaneously!*

This is not the case, if the System Monitor window is closed, and opened after the start time for the scheduled recordings have started: onlu one mencoder process is present, leading to the behavior desribed at the top of this reply.

Weird, huh?! Comments; solutions? ...

The behavior with having the System Monitor window open was not reproducible, all of the time. I added a "sleep 1" command before the mencoder line in one of the scripts; this seems to work, allowing simultaneous recordings to start at the 'same' time.