Jump to content

include() question


realjumper

Recommended Posts

Hi,

 

I have a script to backup  a particular database. If I create another instance of this script I can backup a different database, and so on. If I have (say) 10 databases to backup, I would have to create 10 instances of this script. That's not the problem. The problem is that rather than create 10 cron jobs, I would like to have one file call the 10 scripts, with a 30 second interval between them. Then I would only need one cron job. Is there a way to have one script call other scripts? I have tried variations on the code below, but only the first script gets called.

 


<?php

include_once "backup_scripts/execute_db1_backup.php";

sleep(30);

include_once "backup_scripts/execute_db2_backup.php";

?>

Link to comment
Share on other sites

Because if I include the two files, there are some function names in those two files that are the same, but do different tasks because they are for different databases. So I guess there is confusion in the script as to which function I am trying to call...because they both have the same name...._I think!_

Link to comment
Share on other sites

Yes u r right u have to if statement or switch statement.

 

Also i think u should change this:

include_once "backup_scripts/execute_db1_backup.php";

 

to this:

include_once ('backup_scripts/execute_db1_backup.php');

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.