473,406 Members | 2,713 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,406 software developers and data experts.

launch other script

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
secondscipt.php and continue the script, without waiting it to finish.

Thanks

Bob
Jul 17 '05 #1
8 2787
Bob Bedford <be******@YouKnowWhatToDoHerehotmail.com> wrote:
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
secondscipt.php and continue the script, without waiting it to finish.

Thanks

Bob
Execute and dispatch it: exec('/path/to/php -f /path/to/otherscript.php/dev/null 2>/dev/null &');

Exact command line may differ depending on the installed shell.

--
Simon Stienen <http://dangerouscat.net> <http://slashlife.de>
»What you do in this world is a matter of no consequence,
The question is, what can you make people believe that you have done.«
-- Sherlock Holmes in "A Study in Scarlet" by Sir Arthur Conan Doyle
Jul 17 '05 #2
"Bob Bedford" <be******@YouKnowWhatToDoHerehotmail.com>
wrote in message news:<41***********************@news.sunrise.ch>.. .

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
secondscipt.php and continue the script, without waiting it to finish.


You can do this, but you need administrator privileges on your
server. You have two options:

1. Launch the second script in the background via exec/wget:

exec('wget http://server.com/path/secondscript.php ' .
'--quiet -O /dev/null &');

2. Launch the second script in the background via command-line
interface:

exec('php /path/secondscript.php &');

Cheers,
NC
Jul 17 '05 #3
"Nikolai Chuvakhin" <nc@iname.com> a écrit dans le message de
news:32**************************@posting.google.c om...
"Bob Bedford" <be******@YouKnowWhatToDoHerehotmail.com>
wrote in message news:<41***********************@news.sunrise.ch>.. .

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
secondscipt.php and continue the script, without waiting it to finish.


You can do this, but you need administrator privileges on your
server. You have two options:

1. Launch the second script in the background via exec/wget:

exec('wget http://server.com/path/secondscript.php ' .
'--quiet -O /dev/null &');

2. Launch the second script in the background via command-line
interface:

exec('php /path/secondscript.php &');

I've no EXEC right, or even system rights. how to do ?

Bob
Jul 17 '05 #4
Bob Bedford <be******@YouKnowWhatToDoHerehotmail.com> wrote:
"Nikolai Chuvakhin" <nc@iname.com> a écrit dans le message de
news:32**************************@posting.google.c om...
"Bob Bedford" <be******@YouKnowWhatToDoHerehotmail.com>
wrote in message news:<41***********************@news.sunrise.ch>.. .

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
secondscipt.php and continue the script, without waiting it to finish.


You can do this, but you need administrator privileges on your
server. You have two options:

1. Launch the second script in the background via exec/wget:

exec('wget http://server.com/path/secondscript.php ' .
'--quiet -O /dev/null &');

2. Launch the second script in the background via command-line
interface:

exec('php /path/secondscript.php &');

I've no EXEC right, or even system rights. how to do ?

Bob


humm... If you ignore connection aborts in the second script you could call
it using Sockets... The request would be:

-----BEGIN HTTP-REQUEST BLOCK-----
GET /onlinepath/to/yourscript.php HTTP/1.1
Host: www.yourserver.tld

------END HTTP-REQUEST BLOCK------
, using \r\n as line break.
Don't forget the empty line at the end (the query string will end with
"\r\n\r\n")!
--
Simon Stienen <http://dangerouscat.net> <http://slashlife.de>
»What you do in this world is a matter of no consequence,
The question is, what can you make people believe that you have done.«
-- Sherlock Holmes in "A Study in Scarlet" by Sir Arthur Conan Doyle
Jul 17 '05 #5
"Bob Bedford" <be******@YouKnowWhatToDoHerehotmail.com> wrote in message news:<41***********************@news.sunrise.ch>.. .
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
secondscipt.php and continue the script, without waiting it to finish.


Do you really need to continue processing the first script? Could you
do all the necessary processing left in the first script and then use
a header re-direct to the second script?
Jul 17 '05 #6
> I've a script that must "launch" an other script on some situations.

In most cases the need to do something like this falls under two categories:
1 - I need to pass the request on to another script because I am done with
the current script
Solution: Header() function.

2 - I need to do some maintanance or cleanup such as deleting temp files, or
removing stale entries from the database.
Solution: External script or application that is run from the Cron Daemon or
Windows Task Scheduler.

I'd be surprised to find your problem falls under another category. Can you
describe your needs further?

____________________________________
Wil Moore III, MCP | Integrations Specialist
Jul 17 '05 #7
> Do you really need to continue processing the first script? Could you
do all the necessary processing left in the first script and then use
a header re-direct to the second script?


I'll explain:
1- the user enter new article details for sell in script1.php
2- the user clicks "submit" and the script call insert1.php
3a- All customers who are looking for such article (on some criteria, color,
price...) must be contacted by an email with a link pointing to the new
article. the user doesn't need any information from here ! so it's an
independent process.
3b- insert1.php insert the article in the database and then inform the user
that the article is inserted in the shop.

3a should be executed when the script is submitted at point 2, but the user
doesn't need any information from it, and since it takes a long time, it
should be executed without the need to wait on it.
3b is also submitted at the point 2, but it returns information, and must
not wait until 3a is finished, as they are 2 different processes.

How to launch 3a (3b is what appens now, but I don't know how to launch 3a
without the need to wait is finished to continue).

Bob
Jul 17 '05 #8
> 2 - I need to do some maintanance or cleanup such as deleting temp files,
or
removing stale entries from the database.
Solution: External script or application that is run from the Cron Daemon or Windows Task Scheduler.

The exact point is the second one !!!

I've no CRON daemon possibility as I've no rights on the server (exec, cron,
system have been unactivated for security reasons). I may call a script from
house, with Task Scheduler, but it will be called on selected time, not when
a new article is inserted. I'd like the process to run when a new article is
inserted, not 2 hours later ! I'm also against to have my machine to run
24/24 7/7 for calling a script on a server. The process should be done
directly from the scripts themselves.

I'll explain what I need:
1- the user enter new article details for sell in script1.php
2- the user clicks "submit" and the script call insert1.php
3a- All customers who are looking for such article (on some criteria, color,
price...) must be contacted by an email with a link pointing to the new
article. the user doesn't need any information from here ! so it's an
independent process.
3b- insert1.php insert the article in the database and then inform the user
that the article is inserted in the shop.

3a should be executed when the script is submitted at point 2, but the user
doesn't need any information from it, and since it takes a long time, it
should be executed without the need to wait on it.
3b is also submitted at the point 2, but it returns information, and must
not wait until 3a is finished, as they are 2 different processes.

How to launch 3a (3b is what appens now, but I don't know how to launch 3a
without the need to wait is finished to continue).

Bob
Jul 17 '05 #9

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: aure_bobo | last post by:
Hi all, I'm currently developping a web app, and this one must be compatible with IE and Mozilla Firefox. In this webapp, I would like to launch automatically a anchor link (href) with a...
1
by: Jacob | last post by:
I have several web apps that I want to redirect to a new page, but have that page open in a new browser window. The basic scenario is that I have a CrystalReport object that gets created and...
1
by: pmclinn | last post by:
The code below is generated by an application that allows you to put a Microsoft assistant on a webpage. I'm having a heck of a time trying to get this script to launch on a server side button...
5
by: Frank | last post by:
The following code will not work in my shtml page at all and I can not figure out the reason. I get the error that there is a "Type Mismatch 'Launch'" when i click the button. If i change the...
6
by: Francois Bonzon | last post by:
Any idea how I can launch a background task from a PHP script? For example, when a user posts on my message board, it may fire many e-mail notifications to other users, and other tasks. I want...
11
by: David Thielen | last post by:
Hi; In a page, when the user clicks on a button, I want to validate all the controls (in the code behind) and then if they are good, leave that page alone and launch a new window with a new url...
1
by: Ernest | last post by:
Trying to launch my flash videos by passing their URL listed in a field on MYSQL via PHP script. Any help is greatly appreciated. 1) I am able to launch the video referenced directly in main...
1
BezerkRogue
by: BezerkRogue | last post by:
I have created a VB Script to synchronize software versions and then launch an application on the system it is run against. The script runs and generates no errors but will not launch the second...
7
by: Samuel A. Falvo II | last post by:
I have a shell script script.sh that launches a Java process in the background using the &-operator, like so: #!/bin/bash java ... arguments here ... & In my Python code, I want to invoke...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
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,...
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...
0
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,...

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.