Results 1 to 3 of 3

Thread: Forcing disk sync while specific program is running

  1. #1
    Join Date
    Feb 2005
    Location
    Canada
    Beans
    Hidden!
    Distro
    Ubuntu

    Question Forcing disk sync while specific program is running

    Hi Folks, I´m stuck on a little problem that I can´t quite wrap my brain around.

    Code:
    #!/bin/bash
    
    OUTPUT="/home/gord/Desktop/pvr/`date +%y%m%d-%H%M.avi`"
    
    mencoder /dev/video1 \
             -ovc lavc    -lavcopts vcodec=mpeg4:vbitrate=1400:keyint=30 \
             -oac mp3lame -lameopts cbr:br=128:mode=3 -vop scale=528:360,pp=lb \
             -endpos 00:29:59 -o $OUTPUT
    
    exit 0
    In the above script, I´m using mencoder to record a video stream from /dev/video1 for 29:59. What I´d like to do is force a disk ´sync´ every 5 seconds during the time that mencoder is running and then stop. Does anyone have any idea´s how this could be accomplished?

    Gord

  2. #2
    Join Date
    Jan 2006
    Beans
    961

    Re: Forcing disk sync while specific program is running

    maybe: man 1 sync

  3. #3
    Join Date
    Feb 2005
    Location
    Canada
    Beans
    Hidden!
    Distro
    Ubuntu

    Smile Re: Forcing disk sync while specific program is running [solved]

    Quote Originally Posted by lnostdal View Post
    maybe: man 1 sync
    Thanks Inostdal,

    I should have tried IRC before posting. I´ve got my solution... here it is:

    Code:
    #!/bin/bash
    
    OUTPUT="/home/gord/Desktop/pvr/`date +%y%m%d-%H%M.avi`"
    
    mencoder /dev/video1 \
             -ovc lavc    -lavcopts vcodec=mpeg4:vbitrate=1400:keyint=30 \
             -oac mp3lame -lameopts cbr:br=128:mode=3 -vop scale=528:360,pp=lb \
             -endpos 00:29:59 -o $OUTPUT &
    
    while [ ¨$(pidof mencoder)¨ != ¨¨ ]; do sync; sleep 5; done
    
    exit 0
    This executed mencoder in the background and then enters a loop that executes ´sync´ every 5 seconds until mencoder stops.

    Thanks
    Gord

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •