473,796 Members | 2,434 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 3432
go****@czeplak. de (Christoph) wrote in message news:<f9******* *************** ****@posting.go ogle.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
11283
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 in a certain directory and then fire the script when the file count reaches a certain number, and then clear out the directory... or something like that. Any suggestions? Thanks in advance.
5
9206
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
2816
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 not necessary in "firstscript.php" to wait until it's finished. So how to launch
2
13350
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 to. besides the php scripts, i have other scripts run under cron jobs, such as perl scripts and log files. I couldnt understand why my php scripts doesnt work under cron job.
10
2159
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: http://www.autostratus.com/index.php?whatPage=makeRss It does just what I want it to do. However, I need for this script to get called every 15 minutes. So I set it up as a cron job. And cron doesn't like calling this thing. Cron
3
3416
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 indefinitely once it starts? If cron starts it every 10 minutes. How can I check if I my process is running and then end if an instance is already running? Thanks
3
2584
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. The scripts work fine when run via the command line as root, but when run via the cron they cause a mysql connection error. Call to undefined function: mysql_pconnect()
4
4416
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 pictures in it. the script looks in the specified dir, and creates thumbnails if they are not present. So, displaying a particular album often takes quite a while. I've set the proper php.ini stuff to accomodate the long script_execution's. Thats all
3
2348
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 the interpreter manually...look what it says: i've tried with /web/cgi-bin/php "$HOME/html/path/to/my/script.php as command and it doesn't work. if i run the script in browser it works...what should i introduce as a command..and do i have...
0
10455
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10228
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10173
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9052
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6788
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5573
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4116
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3731
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2925
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.