Scheduled Maintenance: We are aware of an issue with Google, AOL, and Yahoo services as email providers which are blocking new registrations. We are trying to fix the issue and we have several internal and external support tickets in process to resolve the issue. Please see: viewtopic.php?t=158230

 

 

 

streamer video tuner recording don't work with cron

Graphical Environments, Managers, Multimedia & Desktop questions.
Post Reply
Message
Author
User avatar
sensovision
Posts: 113
Joined: 2004-11-15 11:38
Location: Ukraine
Contact:

streamer video tuner recording don't work with cron

#1 Post by sensovision »

Hi! This weekend I'm planning to go for small trip and wish to record serial we're watching. I've made this script:
# cat /bin/tvrec

Code: Select all

#!/bin/bash

streamer -f mjpeg -F mono8 -r 18 -t 160:0 -o /opt/File-Storage/Movies/1.avi
If I run this script as user or root it's do job like it should and I got signal written from my tv-tuner, although if I try to run cron job something weird is happenning, it's only record approx. 3 seconds and die... so I end up with few seconds movie instead of whole film :-\
Is there some timeout time which allowed for scripts execution?
I'd appreciate any help or ideas how to record my movie.

PS here sample of the strng from my cron:
03 20 4 Jul * /bin/tvrec
Denis

lacek
Posts: 764
Joined: 2004-03-11 18:49
Location: Budapest, Hungary
Contact:

#2 Post by lacek »

I don't know whether cron applies any time limit to the applications which are spawned by it, but you may check it easily, writing your script to send the command to the background and give the job to init. This way, cron will no longer be the parent of the process, therefore won't kill it (if it killed it because of time limit, and not the application itself died for some reason).
Here's how to modify the script:

Code: Select all

#!/bin/bash 
 
streamer -f mjpeg -F mono8 -r 18 -t 160:0 -o /opt/File-Storage/Movies/1.avi &
disown

User avatar
sensovision
Posts: 113
Joined: 2004-11-15 11:38
Location: Ukraine
Contact:

#3 Post by sensovision »

hi lackek! thanks for suggestion I've already tried & but I wasn't aware of disown, I'm going to try it. will let you know whever it work or not
Denis

User avatar
sensovision
Posts: 113
Joined: 2004-11-15 11:38
Location: Ukraine
Contact:

#4 Post by sensovision »

nope, unfortunately this doesn't help :( same 3 seconds record...
the most weird thing that if I run script from command line it's work perfectly...
maybe it's matter that it's not running in terminal? and I can force it somehow to run through one of terminals?
Denis

lacek
Posts: 764
Joined: 2004-03-11 18:49
Location: Budapest, Hungary
Contact:

#5 Post by lacek »

I'm afraid you can't really force it to run in a terminal, unless you set up, say, a VNC server and connect to it with an xterm, running this script in terminal...
Does the program writes some output? If so, the output should be caught by cron and mailed to you (remove the & and the disown command for this). Couldn't it be that the frgram requires some environmental variable, and if it doesn't find anything, it crashes?

I'm only guessing now...

User avatar
sensovision
Posts: 113
Joined: 2004-11-15 11:38
Location: Ukraine
Contact:

#6 Post by sensovision »

can you tell where should I look for cron output?(I don't get any mails, guess my mail server isn't setted up correctly) as for variable I guess you could be right, as I couldn't imagine what else could be required by script...
Denis

lacek
Posts: 764
Joined: 2004-03-11 18:49
Location: Budapest, Hungary
Contact:

#7 Post by lacek »

I think cron is only able to mail the output, it doesn't print it anywhere. You can override the destination of the mails by setting the "MAILTO" variable to anything (you can do it in crontab). You may want to set up your mailserver anyway...

User avatar
sensovision
Posts: 113
Joined: 2004-11-15 11:38
Location: Ukraine
Contact:

#8 Post by sensovision »

lacek wrote: You may want to set up your mailserver anyway...
just wish to tell that actually lacking of mailserver caused this problem... once mailserver was installed I was able to run any tasks from cron and they didn't exit after few seconds.
I've discover it accidently when removed exim and cron didn't record scheduled movie.
Posting this in case someone facing similar problem and don't know how to solve it.
Denis

Post Reply