By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
431,881 Members | 2,169 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 431,881 IT Pros & Developers. It's quick & easy.

php script behaves different as cron job

P: n/a
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
Jul 17 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
go****@czeplak.de (Christoph) wrote in message news:<f9**************************@posting.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
Jul 17 '05 #2

P: n/a
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 &"

Jul 17 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.