Pause spoolnews if disk space below configured size.
This commit is contained in:
parent
af935ff319
commit
a23246f606
|
@ -28,6 +28,15 @@ $script_path = $config_dir . "/scripts/";
|
|||
$CONFIG = include ($config_file);
|
||||
$OVERRIDES = include ($config_dir . '/overrides.inc.php');
|
||||
|
||||
// Spool directory size and minimum in Gigabytes
|
||||
$min_spool_disk_space = 2;
|
||||
$free_spool_disk_space = disk_free_space($spooldir)*9.313E-10;
|
||||
if($free_spool_disk_space < $min_spool_disk_space) {
|
||||
$low_spool_disk_space = true;
|
||||
} else {
|
||||
$low_spool_disk_space = false;
|
||||
}
|
||||
|
||||
$logdir = $spooldir . '/log';
|
||||
$debug_log = $logdir . '/debug.log';
|
||||
$lockdir = $spooldir . '/lock';
|
||||
|
|
|
@ -63,6 +63,12 @@ if (! isset($CONFIG['enable_nntp']) || $CONFIG['enable_nntp'] != true) {
|
|||
$workpath = $spooldir . "/";
|
||||
$path = $workpath . "articles/";
|
||||
|
||||
if($low_spool_disk_space) {
|
||||
print "Low Disk Space (less than ".$min_spool_disk_space." available)\n";
|
||||
file_put_contents($logfile, "\n" . format_log_date() . " " . $config_name . " Low Disk Space (less than ".$min_spool_disk_space." available for spool). Pausing spoolnews", FILE_APPEND);
|
||||
exit();
|
||||
}
|
||||
|
||||
$lockfile = $lockdir . '/' . $config_name . '-spoolnews.lock';
|
||||
$pid = file_get_contents($lockfile);
|
||||
if (posix_getsid($pid) === false || ! is_file($lockfile)) {
|
||||
|
|
Loading…
Reference in New Issue