Added extra vault error checking

This commit is contained in:
Karl Cordes 2011-09-26 17:50:57 +10:00
parent 519e2cced5
commit 7e4f59f322

View file

@ -41,7 +41,7 @@ class VaultShell extends Shell {
$processed_dir = '/var/www/cakephp/app/processed_vaultmsgs';
$lockfile = '/var/www/cakephp/app/vault.lock';
}
if(file_exists($lockfile)) {
die("Error: Another process is currently running. Terminating this one");
}
@ -50,7 +50,7 @@ class VaultShell extends Shell {
die("FATAL ERROR: Unable to create vault.lock");
}
}
/* Find the strings we want to look for in the subjects. Build arrays
* using the string as the keys, IDs as the value
@ -116,7 +116,12 @@ class VaultShell extends Shell {
if(!$content) {
echo "No Content Found. Ignoring this email\n";
if(!$this->makeSymlink($email_filename, $vault_dir, $processed_dir)) {
die("Unable to make symlink to process this email Critical error: {$email_filename}");
echo "Unable to make symlink to process this email Critical error: {$email_filename}\n";
if(!unlink($lockfile)) {
die("FATAL ERROR: Unable to remove vault.lock. No further Vault instances can run!");
}
}
else {
continue;