Commit a258109685286a82a11d77411e7805237325af28

Authored by kevin_fourie
1 parent b74093e0

Merged in from STABLE trunk...

KTS-3496
"Error (warning fopen) when opening ktdms application under Linux"
Fixed. Added chown to nobody on script init if current user is root.

Committed By: Kevin Fourie
Reviewed By: Conrad Vermeulen 


git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/STABLE/branches/3.5.3-Release-Branch@8800 c91229c3-7414-0410-bfa2-8a42b809f60b
Showing 1 changed file with 12 additions and 1 deletions
bin/scheduler.php
... ... @@ -51,6 +51,17 @@ if(file_exists($lock)){
51 51 exit(0);
52 52 }
53 53  
  54 +// If this is *nix and we are root then make sure file permisions are correct
  55 +if(!OS_WINDOWS && (get_current_user() == 'root'))
  56 +{
  57 + // The log files...
  58 + try {
  59 + $default->log->debug( 'Scheduler: setting owner to nobody on - '.$default->logDirectory);
  60 + exec('chown -R nobody:0 '.escapeshellcmd($default->logDirectory));
  61 + } catch(Exception $e) {
  62 + $default->log->debug('Scheduler: can\'t set owner to nobody - '.$e);
  63 + }
  64 +}
54 65  
55 66 /* ** Set up functions ** */
56 67  
... ... @@ -262,4 +273,4 @@ if (empty($aList))
262 273  
263 274 $default->log->debug('Scheduler: stopping');
264 275  
265   -?>
266 276 \ No newline at end of file
  277 +?>
... ...