Professional Web Applications Themes

php script behaves different as cron job - PHP Development

Hi, I wrote a php script, which calls with the system-command the commandline tool "transcode". transcode is a tool to convert audio and video files in different codecs. When I call the php-script in the commandline like this: php myScripct.php it works fine and transcode render my video files well. But when I run the php-script as a cron job like "5 * * * root php /path/myscript" the script behaves different. It starts the system call but it seams, that it doesn't wait until transcode finish its work. The file that transcode generate are all 0 KB. What can ...

  1. #1

    Default php script behaves different as cron job

    Hi,

    I wrote a php script, which calls with the system-command the
    commandline tool "transcode". transcode is a tool to convert audio and
    video files in different codecs.
    When I call the php-script in the commandline like this: php
    myScripct.php it works fine and transcode render my video files well.
    But when I run the php-script as a cron job like "5 * * * root php
    /path/myscript" the script behaves different. It starts the system
    call but it seams, that it doesn't wait until transcode finish its
    work. The file that transcode generate are all 0 KB.

    What can I do?

    Christoph Czeplak
    Christoph Guest

  2. #2

    Default Re: php script behaves different as cron job

    [email]googleczeplak.de[/email] (Christoph) wrote in message news:<f9e85222.0311110130.449341feposting.google. com>...
    > Hi,
    >
    > I wrote a php script, which calls with the system-command the
    > commandline tool "transcode". transcode is a tool to convert audio and
    > video files in different codecs.
    > When I call the php-script in the commandline like this: php
    > myScripct.php it works fine and transcode render my video files well.
    > But when I run the php-script as a cron job like "5 * * * root php
    > /path/myscript" the script behaves different. It starts the system
    > call but it seams, that it doesn't wait until transcode finish its
    > work. The file that transcode generate are all 0 KB.
    >
    > What can I do?
    >
    > Christoph Czeplak


    Why dont you try to run it using lynx. Thats what i do when i want to
    run it in a cron.

    for eg: 5 * * * * lynx -dump scriptname.php

    Try it this way.

    Karthik
    Karthik Guest

  3. #3

    Default Re: php script behaves different as cron job

    Christoph wrote:
    > Hi,
    >
    > I wrote a php script, which calls with the system-command the
    > commandline tool "transcode". transcode is a tool to convert audio and
    > video files in different codecs.
    > When I call the php-script in the commandline like this: php
    > myScripct.php it works fine and transcode render my video files well.
    > But when I run the php-script as a cron job like "5 * * * root php
    > /path/myscript" the script behaves different. It starts the system
    > call but it seams, that it doesn't wait until transcode finish its
    > work. The file that transcode generate are all 0 KB.
    >
    > What can I do?
    >
    > Christoph Czeplak
    Sounds like the cron commands are running in the same process/thread. I
    don't know much about this sort of stuff but you may have to write some
    sort of wrapper which spawns different instances of transcoder (or your
    PHP script) in new threads or processors. Can do this in Java or C++ I
    guess.

    Try putting a & at the end of your /path/myscript command
    (shot in the dark).
    so...
    "5 * * * root php /path/myscript &"

    Terence Guest

Similar Threads

  1. COM / DDE behaves differently in Acrobat Reader 9.0 ??
    By Peter_Freimann@adobeforums.com in forum Adobe Acrobat SDK
    Replies: 8
    Last Post: July 21st, 12:55 PM
  2. Help, Contribute behaves strangly
    By Seven in forum Macromedia Contribute General Discussion
    Replies: 1
    Last Post: September 5th, 12:56 PM
  3. Flash behaves differently on different Browsers!
    By Geoff R in forum Macromedia Flash Actionscript
    Replies: 1
    Last Post: February 13th, 11:39 AM
  4. INed error when running script via cron
    By futsnfup in forum AIX
    Replies: 0
    Last Post: September 23rd, 05:15 PM
  5. [Q] Window from Nib behaves oddly
    By Frederick Cheung in forum Mac Programming
    Replies: 0
    Last Post: July 18th, 03:56 PM

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
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139