using --webui in all util scripts

This commit is contained in:
SJ 2014-05-20 12:55:48 +02:00
parent a913c80172
commit df623c3680
2 changed files with 44 additions and 6 deletions

View File

@ -13,10 +13,10 @@ piler's crontab:
*/15 * * * * /usr/local/bin/indexer --quiet note1 --rotate */15 * * * * /usr/local/bin/indexer --quiet note1 --rotate
### optional: the same report you can see on the health page ### optional: the same report you can see on the health page
30 7 * * * /usr/bin/php LIBEXECDIR/piler/daily-report.php /srv/www/webui.yourdomain.com 30 7 * * * /usr/bin/php LIBEXECDIR/piler/daily-report.php --webui /srv/www/webui.yourdomain.com
### optional: populate accouting data ### optional: populate accouting data
30 6 * * * /usr/bin/php LIBEXECDIR/piler/generate_stats.php /srv/www/webui.yourdomain.com 30 6 * * * /usr/bin/php LIBEXECDIR/piler/generate_stats.php --webui /srv/www/webui.yourdomain.com
### optional: purge aged emails ### optional: purge aged emails
2 0 * * * /usr/local/bin/pilerpurge 2 0 * * * /usr/local/bin/pilerpurge

View File

@ -8,12 +8,40 @@ $averagemessagesweekraw = $averagemessagesmonthraw = $averagemessagesizeraw = $a
$_SERVER['HTTP_USER_AGENT'] = "daily/cron"; $_SERVER['HTTP_USER_AGENT'] = "daily/cron";
if(isset($_SERVER['argv'][1])) { $webuidir = $_SERVER['argv'][1]; } $opts = 'h::v';
$lopts = array(
'webui:',
'verbose'
);
for($i=2; $i<$_SERVER['argc']; $i++){ if ( $options = getopt( $opts, $lopts ) )
if($_SERVER['argv'][$i] == "verbose") { $verbose = 1; } {
if ( isset($options['webui']) )
{
$webuidir = $options['webui'];
} else
{
echo("\nError: must provide path to WebUI directory\n\n");
display_help();
exit;
} }
if ( isset($options['h']) )
{
display_help();
exit;
}
if ( isset($options['verbose']) )
{
$verbose = 1;
}
} else {
display_help();
exit;
}
require_once($webuidir . "/config.php"); require_once($webuidir . "/config.php");
require(DIR_SYSTEM . "/startup.php"); require(DIR_SYSTEM . "/startup.php");
@ -157,4 +185,14 @@ if($fp) {
} }
function display_help() {
$phpself = basename(__FILE__);
echo("\nUsage: $phpself --webui [PATH] [OPTIONS...]\n\n");
echo("\t--webui=\"[REQUIRED: path to the Piler WebUI Directory]\"\n\n");
echo("options:\n");
echo("\t-v Provide a verbose output\n");
echo("\t-h Prints this help screen and exits\n");
}
?> ?>