Hello everyone,
I´m working with a "job table" (mysql). In this table you can find different params that are being used for a php-script. This script works on my database and file operations. Every run of this script takes between 1 minute and 30 minutes, depending on the id from the job table. (e.g. jobexecuter.php?jobid=1...
.jobid=5..
..jobid=15
....). The execution timeout for php scripts has been set to 1 hour. PHP is not working in safe mode. The scripts run in an internal network.
I can work the different scripts manually with my webbrowser and everything works fine so far. So i open the url "jobexecuter.php?jobid=13"
with my browser and with another instance of my browser i open the url "jobexecuter.php?jobid=17"
... This works fine so far.
My question is:
Is there a way to automate this task? I´m searching for a solution like a bash-script (Windows) as well as a shell-script (unix) that gets the upcoming jobid from the database and passes it on to the batch/shell script like:
php -f jobexecuter.php 15
php -f jobexecuter.php 17
php -f jobexecuter.php 22
The background of my question is that i could call these bash/shell scripts via Tasks (Windows) or a cronjob (unix) and wouldn´t have to do it manually with my browsers.
I could get the IDs from the database with another php-script, but how can i pass the return-array to the batch/shell script like:
php -f jobexecuter.php X
... with a loop like:
job.bat
[START Pseudocode]
php -f getids.php > Array
foreach (Array as Jobid)
{ php -f jobexecuter.php Jobid
}
[END Pseudocode]
Another very important task is to run those jobexecutive-scripts at the same time... since there are scripts that can take up to 1 hour... and i would like to run couple of scripts at the same time. Is there a way to run the jobexecute-scripts as "child-processes" or another "multithreading" solution?
Start Free Trial