Skip to content

Commit

Permalink
moved daemon log into cache dir so it only has to contend with 1 set …
Browse files Browse the repository at this point in the history
…of directory permissions. added a conditional check of if is running as root. Will no longer attempt to change the permissions of files unless it is running as root
  • Loading branch information
jessegreathouse committed Jul 27, 2011
1 parent 867dcbe commit e06d1ed
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 9 deletions.
2 changes: 1 addition & 1 deletion DependencyInjection/CodeMemeDaemonExtension.php
Expand Up @@ -54,7 +54,7 @@ private function getDefaultConfig($name, $container)
'appName' => $name,
'appDir' => $container->getParameter('kernel.root_dir'),
'appDescription' => 'CodeMeme System Daemon',
'logLocation' => $container->getParameter('kernel.logs_dir') . '/' . $container->getParameter('kernel.environment'). '.' . $name . '.daemon.log',
'logLocation' => $container->getParameter('kernel.cache_dir') . '/'. $name . '/' . $container->getParameter('kernel.environment'). '.' . $name . '.daemon.log',
'authorName' => 'CodeMeme',
'authorEmail' => 'symfony2.kernel@127.0.0.1',
'appPidLocation' => $container->getParameter('kernel.cache_dir') . '/'. $name . '/' . $name . '.daemon.pid',
Expand Down
18 changes: 10 additions & 8 deletions System/Daemon.php
Expand Up @@ -1310,14 +1310,16 @@ static protected function _summon()
}

// Change identity. maybe
$c = self::_changeIdentity(
self::opt('appRunAsGID'),
self::opt('appRunAsUID')
);
if (false === $c) {
self::crit('Unable to change identity');
if (self::opt('appDieOnIdentityCrisis')) {
self::emerg('Cannot continue after this');
if (0 === exec("id -u")) {
$c = self::_changeIdentity(
self::opt('appRunAsGID'),
self::opt('appRunAsUID')
);
if (false === $c) {
self::crit('Unable to change identity');
if (self::opt('appDieOnIdentityCrisis')) {
self::emerg('Cannot continue after this');
}
}
}

Expand Down

0 comments on commit e06d1ed

Please sign in to comment.