473,395 Members | 1,442 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

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
Jul 17 '05 #1
2 3412
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

29
by: deko | last post by:
Is there a way to get my script to run on regularly scheduled intervals without using cron? My hosting provider sucks... cannot use cron... I was thinking perhaps I could create a file every hour...
5
by: deko | last post by:
In regard to running php scripts with cron - Here is a sample script: <?php //debug.php echo "<br> This is a test"; ?> I can call debug.php from a web page on my site like this:
8
by: Bob Bedford | last post by:
I've a script that must "launch" an other script on some situations. firstscript.php: .... If ($newarticle) //launch secondscript.php .... The "secondscript.php" may take quite long, and is...
2
by: volantecho | last post by:
hi, i m using webmin to create a cron job of a php script. While i click on 'run it now', it works, generate the output. However, the php script doesnt execute for every minutes which i've set...
10
by: lawrence k | last post by:
I've got a script called makeRss.php. It works fine if I try to open it with my browser. It makes an RSS feed for every page on my site. You can see it working here: ...
3
by: Pol | last post by:
Can php scripts be initiated as a cron jobs running indefinately in a loop performing a task? Any recommendations for writing a php script that will run as an unix server process that will run...
3
by: dburdick | last post by:
I was referred to this forum as this may be a php specific problem. Some kind of configuration problem maybe. I have some php files that connect to a mysql database and are run as cron jobs. ...
4
by: J. Frank Parnell | last post by:
Hi there, I have a list of links which point to e.g. thescript.php?album=somePictures1 thescript.php?album=somePictures2 This list is about 3000 links. Each album may have 500 or more...
3
by: uzzi | last post by:
I don't know how to make a php script to work via cron...I want to make it run daily...My server API is CGI/Fast CGI.I have hosting from godaddy and in the help section i found that i have to specify...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.