Find the answer to your Linux question:
Results 1 to 5 of 5
Hello, I'm developing a website YouTUBE like and I need to create a module which upload's a movie and after that I convert's to flv. So to convert a file ...
  1. #1
    Just Joined!
    Join Date
    Aug 2008
    Posts
    3

    How can I know when an instance of any application ends?

    Hello,

    I'm developing a website YouTUBE like and I need to create a module which upload's a movie and after that I convert's to flv.

    So to convert a file to flv I need to execute an application and I would like to know when it ends because this application does not save the file in a temp directory and after that moves it on the output folder so that I will know when a file is completed.

    So does anyone know a way how can I see when the conversion is done?

    Thank you!

  2. #2
    Trusted Penguin Cabhan's Avatar
    Join Date
    Jan 2005
    Location
    Seattle, WA, USA
    Posts
    3,230
    How are you executing the application?

    In C, for instance, when you fork(), the parent process gets the PID of the child process. It can then use the waitpid() function to halt until the child finishes, then it can continue.

    I imagine that most languages support some similar feature.
    DISTRO=Arch
    Registered Linux User #388732

  3. #3
    Just Joined!
    Join Date
    Aug 2008
    Posts
    3
    Well I'm using PHP exec(). So I don't know if there exists any waitPID function.

  4. #4
    Just Joined!
    Join Date
    Aug 2008
    Posts
    3
    I actually don't want that user to wait for the whole conversion process. I just want that the server to know when the video is available to watch.

    Do you know any way?

  5. #5
    Trusted Penguin Cabhan's Avatar
    Join Date
    Jan 2005
    Location
    Seattle, WA, USA
    Posts
    3,230
    Well, how about instead of executing the converter program, you execute another program of yours that executes the converter program. This second program of yours can wait for the converter to finish and then notify your database or whatever.

    You might want to read:
    PHP: exec - Manual

    It discusses how to cause exec() to wait or not.
    DISTRO=Arch
    Registered Linux User #388732

Posting Permissions

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