[MPlayer-users] Mplayer and cron

Nico Sabbi nsabbi at tiscali.it
Wed May 19 09:57:15 CEST 2004


Bill Moseley wrote:

>I want to capture a few minutes of a stream using cron.  I'm wondering
>what the best method is.
>
>My idea is to use this in my crontab:
>
># 2am start recording
>0 2 * * * mplayer -really-quiet -dumpstream -dumpfile $HOME/out.rm rtsp://<path>.rm
>
># stop at 3am
>0 3 * * * killall mplayer
>
>Is this how most people do that?  Or is there a better suggestion?
>
>
>I though about doing this in cron, but I can't seem to get it to work:
>
>   mplayer [...] & sleep 1h; killall mplayer
>
>mplayer doesn't seem to work in the background, although I can ^Z and then run
>in the background (bg).  
>
>It works with other programs, for example I can do:
>
>   mpg123 foo.mp3 & sleep 10s; killall mpg123
>
>But, I admit my shell skills are not that great.
>
>Thanks,
>
>
>  
>

put your command in an executable script and put the complete 
script-path in the cron, instead:

record.sh:

#!/bin/bash

HOME=/home/me

mplayer -really-quiet -dumpstream -dumpfile $HOME/out.rm rtsp://<path>.rm


in your crontab:

# 2am start recording
0 2 * * * /usr/local/bin/record.sh







More information about the MPlayer-users mailing list