PDA

View Full Version : How to setup Auto Import of UTStats for your UnrealTournament server



SAM
11-08-2013, 12:05 PM
When I tried to setup the UTStats trigger mod (which auto imports) I had some trouble and the shell script just wasn't executing. Don't know why so don't ask me!

Anyhow, here is an alternative explanation how to implement this. No additional serverside or webserver modifications required. It simply uses the FTP feature already built into UTStats to upload to the webserver, and the webserver then just executes (via cron) the import script.

1) Setup your UTStats FTP account. This needs to be for the script to access the gameserver.
2) Setup the /includes/config.php to look something similar to this (config from the Instagib UK server):

//UT Server 1
$i = 0;
$ftp_hostname[$i] = '185.16.85.10'; // FTP server location here
$ftp_port[$i] = FTPPORT; // FTP Port - do not remove this even if you do not use ftp
// Do not add '' around the port either
$ftp_uname[$i] = 'FTPUSER'; // FTP Username
$ftp_upass[$i] = 'FTPPASS'; // FTP Password
$ftp_dir[$i][] = '/185.16.85.10 port 7777/Logs'; // Directory of the log files - MUST NOT end with a /
//$ftp_dir[$i][] = '/'; // You may repeat this entry as often as you wish but please remember
//$ftp_dir[$i][] = '/'; // to enter the directory relative to the last one
//$ftp_dir[$i][] = '/'; // (or use an absolute path)
$ftp_passive[$i] = true; // Use passive transfer mode for this connection?
$ftp_delete[$i] = true; // Delete logs after download?

3) Setup your cronjob



php -q -f /home/your_webdir_username/public_html/stats/import.php var1=your_import_password
(replace your_import_password with import password and replace your_webdir_username with your username)

With the above config, your webserver *should* execute upload. However there may be limitations set by your host allowing a minimum interval of 15 minutes. In any case, it should still work as long as they don't have a daemon/process monitoring executions.

You should also add *before the command line execution* when you would like it to execute

CronJob explanation
Basic crontab schedule consists of six field/variables:
minute hour day month day-of-week command-line-to-execute

If I wanted the cron to take place once an hour, I would use the following:

0 * * * * php -q -f /home/your_webdir_username/public_html/stats/import.php var1=your_import_password

If I wanted the cron to run at 8PM


0 20 * * * php -q -f /home/your_webdir_username/public_html/stats/import.php var1=your_import_password

And so on...