INSTRUCTIONS
- Move All the contents from ./usr/bin to your /usr/bin folder on your machine. (do this for all servers and central machine)

-Copy the Autopilot folder anywhere on both your servers' and central box. Keep the file paths consistent. Makes life easier.
-Edit Global.class.php
-Edit HOST,PORT,USER to reflect your central machine's SSH info.
-REMOTEDIR= the full path to the autopilot/global folder on your CENTRAL Machine.
-LOCALDIR= full path to autopilot/local on Server machine.

-Edit Autopilot.class.php
-Change Database connection info to reflect yours.
-Change MYMACHINE to reflect your machine's IP address (the IP of the box you intend to run an instance of the server script on)
-Execute pilot.sql on your database.

-Upload the WWW folder to a directory on your central server capable of serving web pages. If your on OS X, just install MAMP. It includes
Apache, mysql & php. Pretty much everything you need to run this.

# Now we are almost ready to launch DHDS. But first we need to ensure our servers can communicate freely with our central box and vise versa.
- Preform a DSA key swap from your servers->central, then central->server.
Ex:
(on server)
% ssh-keygen -t dsa
- leave all options blank
this will generate a .pub file in ~./ssh folder. Copy its contents to your central box's ~/.ssh/authorized_keys file.
This will allow your server to connect to the central box freely without asking for a password.
Now do the same thing, the other way around - Generate a DSA Key on your central server, and copy it to your server's authorized_keys file.
You don't have to make a new DSA key for the central server for each server you add. You can re-use the same one.

Now, to add some jobs. Insert jobs into the `jobs` table in the MySQL DB. TCID,FAMILY are used only as labels designed for TCDB. The only columns
that are used for processing are ACC1 and ACC2. Insert jobs accordingly. Leave status=0 for all.

When you are ready, start the server application on all your Server boxes.
To ensure proper data retrieval, enable the following cron command to run every 15 mins on your central box.

15     *       *       *       *       php /Users/saierlab/autopilot/pilot.php planb

This will actively monitor packages and make sure they are always properly sent. It will re-download packages if they failed for whatever reason.
Obviously, change the file path accordingly.

To create a new cronjob, type into your shell:
% crontab -e


When the jobs are all complete (www/stats.php to view realtime stats)
You must move them to the analysis table.

Run this on your central server:
% ./pilot.php analysis

To display results, edit www/paths.php and update your correct filepath to the autopilot folder.
Then edit index.php and locate the line that says:
# foreach($analysis->load_results("2.A.%.%.1","9.A.%.%.1") as $row)
change the families to reflect the ones you just analyzed. Launch index.php via browser, and enjoy your results.



Server Commands:

Start Server Application:
% ./start.php <int>
OR
% ./pilot.php autopilot <int> > /dev/null &
where <int> = number of parallel jobs. 3 is recommended.
We are limited here by NCBI's max connections. V2 will use NCBI's hard-files,
so this number can be changed to over 20 then.

Kill Server application:
% ./kill.php
  
------------------------

Central DB Commands:
./pilot.php analysis
^ This command will move all jobs from the `jobs` table to the `analysis` table and tabulate the results.