Avogadro automatically makes CSV backups of scoring information available via FTP from the instance's main directory. If you log in using the instance's FTP username and password, the home folder for that user will contain a “backup” folder. Within that folder will be a CSV file for each event (named “event_[ID].csv”, where [ID] is the ID number of the event), and an overall results file (named 'overall.csv').

These files are automatically updated whenever an event gets updated scoring information. An administrator can trigger a full backup at any time by visiting 'http://avogadro.ws/hosted/[COMP_NAME]/admin/forcebackup', replacing [COMP_NAME] with the short name of the desired competition instance.

With this setup, you can create your own backup server to keep an offline copy of the scoring information for your instance. If you have a computer running Linux (or Mac OSX) on-site, likely it has either the 'wget' or 'curl' command-line download utilities installed already. Set it up to run either:

wget --ftp-user=my_user@avogadro.ws --ftp-password=mypassword ftp://avogadro.ws/backup/overall.csv

or

curl --user my_user@avogadro.ws:mypassword ftp://avogadro.ws/backup/overall.csv -O

(depending on which command-line utility you wish to use) on a periodic interval. Then, if for some reason you lose internet connection during the competition, you can go to your backup server and retrieve the most recent set of scores, to continue the competition using an alternate scoring system.

PHP script

If you have a server with PHP installed, with the curl extension, you can use the following script as a more advanced backup retrieval system. It automatically grabs all the backup files, and keeps the most recent three versions in addition to the current version (old versions get named with a suffix, with “_o1” being the most recent, “_o2” the next, and “_o3” the oldest.

<?php
// Fetch FTP backups of Avogadro data
header("Content-type: text/plain");
 
$conn = ftp_connect("ftp.avogadro.ws");
if (!$conn) {
	die("Couldn't locate server");
} else {
	echo "Connected to server\n";
}
if(!ftp_login($conn, "my_username@avogadro.ws", "my_password")) {
	die("Couldn't connect to server");
} else {
	echo "Logged into server\n";
}
ftp_pasv($conn, true);
 
if (!ftp_chdir($conn, "backup")) {
	die("Failed to access backup folder");
} else {
	echo "Moved to backup folder\n";
}
echo "Located at ".ftp_pwd($conn)."\n";
 
$dir = ftp_nlist($conn, "."); // Get all files from this directory.
 
foreach($dir as $file) {
	if (strlen($file) > 4 && substr($file, -4) == ".csv") {
		// This is a CSV file
		$base = basename($file, ".csv"); // What is this file's base name
		$tmpName = $base."_n.csv";
		if (ftp_get($conn, $tmpName, $file, FTP_BINARY)) {
			// File downloaded successfully
			// Shuffle the archives:
			if (file_exists($base."_o3.csv")) { unlink($base."_o3.csv"); }
			if (file_exists($base."_o2.csv")) { rename($base."_o2.csv", $base."_o3.csv"); }
			if (file_exists($base."_o1.csv")) { rename($base."_o1.csv", $base."_o2.csv"); }
			if (file_exists($base.".csv")) { rename($base.".csv", $base."_o1.csv"); }
			rename($base."_n.csv", $base.".csv");
			echo "Updated '$base'\n";
		} else {
			// File not downloaded
			echo "Failed to download '$file'\n";
		}
	}
}
ftp_close($conn);
?>