Vault fixes. Added vault.locking

This commit is contained in:
Karl Cordes 2011-09-26 17:41:17 +10:00
parent 29bb1b322d
commit 519e2cced5
2 changed files with 19 additions and 5 deletions

View file

@ -25,21 +25,31 @@ class VaultShell extends Shell {
$testing = 0; //Whether to actually move the emails. 1=test, 0=production
if($testing == 1) {
$ripmime_path = '/opt/local/bin/ripmime';
$email_dir = '/Users/karlcordes/Sites/quotenik/app/emails';
$vault_dir = '/Users/karlcordes/Sites/quotenik/app/vaultmsgs';
$processed_dir = '/Users/karlcordes/Sites/quotenik/app/processed_vaultmsgs';
$lockfile = '/Users/karlcordes/Sites/quotenik/app/vault.lock';
}
else {
$ripmime_path = '/usr/local/bin/ripmime';
$email_dir = '/var/www/cakephp/app/emails';
$vault_dir = '/var/www/cakephp/app/vaultmsgs';
$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");
}
else {
if(!touch($lockfile)) {
die("FATAL ERROR: Unable to create vault.lock");
}
}
/* Find the strings we want to look for in the subjects. Build arrays
@ -376,6 +386,10 @@ class VaultShell extends Shell {
}
if(!unlink($lockfile)) {
die("FATAL ERROR: Unable to remove vault.lock. No further Vault instances can run!");
}
}